nxlog4go is very simple to use without any configuring, setting. For example:


package main import (
"time"
log "github.com/ccpaging/nxlog4go"
) func main() {
log.Fine("This should be omitted as default.")
log.Debug("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
log.Warn("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
log.Critical("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02"))
}

Compatibility with go log

The most programmer always use go log for testing. nxlog4go aimed the replacement of go log.

Log Function Level After
Crash, Crashf CRITICAL, panic panic
Exit, Exitf ERROR, exit exit
Stderr, Stderrf ERROR
Stdout, Stdoutf INFO

New log functions

Log Function Level Default
Finest(...) 0 Omit
Fine(...) 1 Omit
Debug(...) 2
Trace(...) 3
Info(...) 4
Warn(...) 5
Error(...) 6
Critical(...) 7

Set display level

For example:

	log.GetLogger().SetLevel(log.FINE)
log.Fine("This should be not omitted now.")

log.GetLogger() return the point of default Global Logger.

SetLevel(log.FINE) sets level to log.FINE.

最新文章

  1. HashMap实现缓存
  2. [To do]Appx Package installed, can't start at first time
  3. OpenXml入门
  4. Nginx+HTTPS(SSL/TLS)
  5. nginx的部署与发布
  6. HDU 1598 find the most comfortable road 并查集+贪心
  7. 王家林的81门一站式云计算分布式大数据&移动互联网解决方案课程第14门课程:Android软硬整合设计与框架揭秘: HAL&Framework &Native Service &App&HTML5架构设计与实战开发
  8. Naive Bayes(朴素贝叶斯算法)[分类算法]
  9. swift + xcode 新手上路
  10. android应用开发--------------看RadioGroup源代码,写相似单选选项卡的集成控件(如底部导航,tab等等)
  11. SQL声明大全
  12. QtNetwork说明(两)使用QT实现360的ctrl+ctrl特征
  13. C#入门经典(第三章-1)
  14. Eddy's picture(最小生成树)
  15. C. The Smallest String Concatenation
  16. 详解:Python2中的urllib、urllib2与Python3中的urllib以及第三方模块requests
  17. Linux - ubuntu中vi不能正常使用方向键与退格键的问题
  18. ArcGis Python脚本——ArcGIS 中使用的 Python 是什么版本
  19. 爬取 Caused by SSLError(SSLError("bad handshake: Error
  20. Golang Vendor 包机制 及 注意事项

热门文章

  1. 毕业设计 python opencv实现车牌识别 码云地址
  2. nginx(二)-反向代理
  3. 给JFinal添加 Sqlite 数据库支持
  4. git平台创建项目(码云)
  5. method reference
  6. JMS介绍
  7. 配intelliJ IDEA 过程
  8. (转)企业Shell实战-MySQL分库分表备份脚本
  9. jquery 属性选择器
  10. TOJ 3486 Divisibility