# timewriter **Repository Path**: ak999/timewriter ## Basic Information - **Project Name**: timewriter - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-12-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TimeWriter TimeWriter implements io.Writer to roll daily and comporess log file time ## Overview * implements io.Writer. You can easily use in golang log, GORM, grpclog etc. * daily roll log, the file name's prefix is process name * compress to gz for old file ## Getting Started **Example** To use TimeWriter, you can git clone [https://github.com/longbozhan/timewriter](https://github.com/longbozhan/timewriter), and import like this: ```go package main import ( "log" ) func main() { timeWriter := &TimeWriter{ Dir: "./log", Compress: true, ReserveDay: 30, } logDebug := log.New(timeWriter, " [Debug] ", log.LstdFlags) logDebug.Println("this is debug") } ``` ## Reference * [lumberject](https://github.com/natefinch/lumberjack)