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.

105 lines
1.8 KiB

  1. package zlog
  2. /*
  3. 全局默认提供一个Log对外句柄可以直接使用API系列调用
  4. 全局日志对象 StdZinxLog
  5. */
  6. import "os"
  7. var StdZinxLog = NewZinxLog(os.Stderr, "", BitDefault)
  8. //获取StdZinxLog 标记位
  9. func Flags() int {
  10. return StdZinxLog.Flags()
  11. }
  12. //设置StdZinxLog标记位
  13. func ResetFlags(flag int) {
  14. StdZinxLog.ResetFlags(flag)
  15. }
  16. //添加flag标记
  17. func AddFlag(flag int) {
  18. StdZinxLog.AddFlag(flag)
  19. }
  20. //设置StdZinxLog 日志头前缀
  21. func SetPrefix(prefix string) {
  22. StdZinxLog.SetPrefix(prefix)
  23. }
  24. //设置StdZinxLog绑定的日志文件
  25. func SetLogFile(fileDir string, fileName string) {
  26. StdZinxLog.SetLogFile(fileDir, fileName)
  27. }
  28. //设置关闭debug
  29. func CloseDebug() {
  30. StdZinxLog.CloseDebug()
  31. }
  32. //设置打开debug
  33. func OpenDebug() {
  34. StdZinxLog.OpenDebug()
  35. }
  36. // ====> Debug <====
  37. func Debugf(format string, v ...interface{}) {
  38. StdZinxLog.Debugf(format, v...)
  39. }
  40. func Debug(v ...interface{}) {
  41. StdZinxLog.Debug(v...)
  42. }
  43. // ====> Info <====
  44. func Infof(format string, v ...interface{}) {
  45. StdZinxLog.Infof(format, v...)
  46. }
  47. func Info(v ...interface{}) {
  48. StdZinxLog.Info(v...)
  49. }
  50. // ====> Warn <====
  51. func Warnf(format string, v ...interface{}) {
  52. StdZinxLog.Warnf(format, v...)
  53. }
  54. func Warn(v ...interface{}) {
  55. StdZinxLog.Warn(v...)
  56. }
  57. // ====> Error <====
  58. func Errorf(format string, v ...interface{}) {
  59. StdZinxLog.Errorf(format, v...)
  60. }
  61. func Error(v ...interface{}) {
  62. StdZinxLog.Error(v...)
  63. }
  64. // ====> Fatal 需要终止程序 <====
  65. func Fatalf(format string, v ...interface{}) {
  66. StdZinxLog.Fatalf(format, v...)
  67. }
  68. func Fatal(v ...interface{}) {
  69. StdZinxLog.Fatal(v...)
  70. }
  71. // ====> Panic <====
  72. func Panicf(format string, v ...interface{}) {
  73. StdZinxLog.Panicf(format, v...)
  74. }
  75. func Panic(v ...interface{}) {
  76. StdZinxLog.Panic(v...)
  77. }
  78. // ====> Stack <====
  79. func Stack(v ...interface{}) {
  80. StdZinxLog.Stack(v...)
  81. }