types.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package logs
  2. import (
  3. "go.uber.org/zap"
  4. "go.uber.org/zap/zapcore"
  5. )
  6. // 通用的日志字段
  7. const (
  8. KeyRequestID string = "requestID"
  9. KeyUsername string = "username"
  10. KeyWatcherName string = "watcher"
  11. )
  12. // Field zap字段别名
  13. type Field = zapcore.Field
  14. // Level zap日志级别别名
  15. type Level = zapcore.Level
  16. var (
  17. // DebugLevel logs are typically voluminous, and are usually disabled in
  18. // production.
  19. DebugLevel = zapcore.DebugLevel
  20. // InfoLevel is the default logging priority.
  21. InfoLevel = zapcore.InfoLevel
  22. // WarnLevel logs are more important than Info, but don't need individual
  23. // human review.
  24. WarnLevel = zapcore.WarnLevel
  25. // ErrorLevel logs are high-priority. If an application is running smoothly,
  26. // it shouldn't generate any error-level logs.
  27. ErrorLevel = zapcore.ErrorLevel
  28. // PanicLevel logs a message, then panics.
  29. PanicLevel = zapcore.PanicLevel
  30. // FatalLevel logs a message, then calls os.Exit(1).
  31. FatalLevel = zapcore.FatalLevel
  32. )
  33. // Alias for zap type functions.
  34. var (
  35. Any = zap.Any
  36. Array = zap.Array
  37. Object = zap.Object
  38. Binary = zap.Binary
  39. Bool = zap.Bool
  40. Bools = zap.Bools
  41. ByteString = zap.ByteString
  42. ByteStrings = zap.ByteStrings
  43. Complex64 = zap.Complex64
  44. Complex64s = zap.Complex64s
  45. Complex128 = zap.Complex128
  46. Complex128s = zap.Complex128s
  47. Duration = zap.Duration
  48. Durations = zap.Durations
  49. Err = zap.Error
  50. Errors = zap.Errors
  51. Float32 = zap.Float32
  52. Float32s = zap.Float32s
  53. Float64 = zap.Float64
  54. Float64s = zap.Float64s
  55. Int = zap.Int
  56. Ints = zap.Ints
  57. Int8 = zap.Int8
  58. Int8s = zap.Int8s
  59. Int16 = zap.Int16
  60. Int16s = zap.Int16s
  61. Int32 = zap.Int32
  62. Int32s = zap.Int32s
  63. Int64 = zap.Int64
  64. Int64s = zap.Int64s
  65. Namespace = zap.Namespace
  66. Reflect = zap.Reflect
  67. Stack = zap.Stack
  68. String = zap.String
  69. Stringer = zap.Stringer
  70. Strings = zap.Strings
  71. Time = zap.Time
  72. Times = zap.Times
  73. Uint = zap.Uint
  74. Uints = zap.Uints
  75. Uint8 = zap.Uint8
  76. Uint8s = zap.Uint8s
  77. Uint16 = zap.Uint16
  78. Uint16s = zap.Uint16s
  79. Uint32 = zap.Uint32
  80. Uint32s = zap.Uint32s
  81. Uint64 = zap.Uint64
  82. Uint64s = zap.Uint64s
  83. Uintptr = zap.Uintptr
  84. Uintptrs = zap.Uintptrs
  85. )