-
简单golang日志Golog.zip下载
资源介绍
Golog 是简单的golang日志,基于golang内置log封装.
特征
实现各种日志 level: DEBUG, INFO, WARN, ERROR
实现各种日志 handlers: ConsoleHander, FileHandler, RotatingHandler
代码实例
// rotating hander, max log files is 4, max file size is 4M
rotatingHandler := logger.NewRotatingHandler("./", "test.log", 4, 4*1024*1024)
// logger set handlers: console, rotating
logger.SetHandlers(logger.Console, rotatingHandler)
defer logger.Close()
// logger set flags
logger.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
// logger set log level
logger.SetLevel(logger.INFO)
logger.Debug("something", "debug")
logger.Info("something")
logger.Warn("something")
logger.Error("something")
标签:Golog