You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1012 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package zlog_test
  2. import (
  3. "github.com/aceld/zinx/zlog"
  4. "testing"
  5. )
  6. func TestStdZLog(t *testing.T) {
  7. //测试 默认debug输出
  8. zlog.Debug("zinx debug content1")
  9. zlog.Debug("zinx debug content2")
  10. zlog.Debugf(" zinx debug a = %d\n", 10)
  11. //设置log标记位,加上长文件名称 和 微秒 标记
  12. zlog.ResetFlags(zlog.BitDate | zlog.BitLongFile | zlog.BitLevel)
  13. zlog.Info("zinx info content")
  14. //设置日志前缀,主要标记当前日志模块
  15. zlog.SetPrefix("MODULE")
  16. zlog.Error("zinx error content")
  17. //添加标记位
  18. zlog.AddFlag(zlog.BitShortFile | zlog.BitTime)
  19. zlog.Stack(" Zinx Stack! ")
  20. //设置日志写入文件
  21. zlog.SetLogFile("./log", "testfile.log")
  22. zlog.Debug("===> zinx debug content ~~666")
  23. zlog.Debug("===> zinx debug content ~~888")
  24. zlog.Error("===> zinx Error!!!! ~~~555~~~")
  25. //关闭debug调试
  26. zlog.CloseDebug()
  27. zlog.Debug("===> 我不应该出现~!")
  28. zlog.Debug("===> 我不应该出现~!")
  29. zlog.Error("===> zinx Error after debug close !!!!")
  30. }