Golog 是简单的golang日志,基于golang内置log封装.
**特征**
1.
实现各种日志 level: DEBUG, INFO, WARN, ERROR
2.
实现各种日志 handlers: ConsoleHander, FileHandler, RotatingHandler
**代码实例**
<pre class="brush:cpp; toolbar: true; auto-links: false;">// 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")</pre>