blog4go.go】的更多相关文章

package blog4go import ( "bufio" "errors" "fmt" "io" "os" "strings" "sync" ) const ( // EOL end of a line EOL = '\n' // ESCAPE escape character ESCAPE = '\\' // PLACEHOLDER placeholder…
log4go 的 4.0.2 版本(https://github.com/ccpaging/log4go/tree/4.0.2)发布以后, 看了看别的 go 语言日志文件设计.发现了一篇好文: log4go 和 logrus 的对比与分析 https://www.doraemonext.com/archives/783.html 顺藤摸瓜,找了一窝关于日志的设计.链接如下(含老的链接): https://github.com/alecthomas/log4go/ 这是log4go项目的"鼻祖&q…
package blog4go import ( "fmt" "os" "sync" "time" ) const ( // unit of sizes _ = iota // ignore first value by assigning to blank identifier // KB unit of kilobyte KB int64 = 1 << (10 * iota) // MB unit of meg…
package blog4go import ( "encoding/xml" "errors" "io/ioutil" "os" ) const ( // TypeTimeBaseRotate is time base logrotate tag TypeTimeBaseRotate = "time" // TypeSizeBaseRotate is size base logrotate tag Typ…
package blog4go import ( "fmt" "path" "strings" ) // NewFileWriter initialize a file writer // baseDir must be base directory of log files // rotate determine if it will logrotate func NewFileWriter(baseDir string, rotate boo…
package blog4go import ( "fmt" "os" "time" ) // ConsoleWriter is a console logger type ConsoleWriter struct { blog *BLog // for stderr errblog *BLog redirected bool closed bool colored bool // log hook hook      Hook hookLeve…
package blog4go import ( "fmt" "strings" ) // LevelType type defined for logging level // just use int type LevelType int const ( // level enum  日志枚举 // TRACE trace level TRACE LevelType = iota // DEBUG debug level DEBUG // INFO info l…
package blog4go import ( "bytes" "fmt" "net" "sync" ) // SocketWriter 是一个socket日志结构体 type SocketWriter struct { level LevelType  //日志级别 closed bool   //链接是否关闭 // log hook hook      Hook  //回调函数 hookLevel LevelType  …
package blog4go import ( "errors" "fmt" ) var ( // ErrFilePathNotFound 文件路径找不到 ErrFilePathNotFound = errors.New("File Path must be defined") // ErrInvalidLevel  非法日志级别 ErrInvalidLevel = errors.New("Invalid level string&q…
package blog4go import ( "sync" "time" ) const ( // PrefixTimeFormat  时间格式前缀 PrefixTimeFormat = "[2006/01/02:15:04:05]" // DateFormat 时间格式 DateFormat = "2006-01-02" ) // timeFormatCacheType是一个时间格式的缓存 type timeFormat…