forked from golang/glog
-
Notifications
You must be signed in to change notification settings - Fork 0
Leveled execution logs for Go
License
ideazw/glog
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
glog ==== 在[golang/glog](https://github.com/golang/glog)的基础上做了一些修改。 ## 修改的地方: 1. 增加每天切割日志文件的功能,并去除了复杂的文件命名,程序运行时指定 --dailyRolling=true 参数即可 2. 将日志等级在原来的基础上增加 DEBUG 3. 去除高等级的日志内容会同时会被记录到低等级的日志文件中 4. 将默认的刷新缓冲区时间由30s改为5s ##使用示例 ``` package main import ( "flag" "./glog" ) func main() { //初始化命令行参数 flag.Parse() //退出时调用,确保日志写入文件中 defer glog.Flush() glog.Infoln("hello-0, glog") glog.Warningln("warning-0 glog") glog.Errorln("error-0 glog") glog.Debugln("debug-0 glog") glog.Info("hello, glog") glog.Warning("warning glog") glog.Error("error glog") glog.Debug("debug glog") glog.Infof("info %d", 1) glog.Warningf("warning %d", 2) glog.Errorf("error %d", 3) glog.Debugf("debug %d",4) } //假设编译后的可执行程序名为demo,运行时指定log_dir参数将日志文件保存到特定的目录 // ./demo --log_dir=./log --dailyRolling=true ```
About
Leveled execution logs for Go
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Go 100.0%