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

logger.go 1.1 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package logger
  2. import (
  3. "reflect"
  4. "github.com/sirupsen/logrus"
  5. )
  6. const (
  7. TRACE_LEVEL = "TRACE"
  8. DEBUG_LEVEL = "DEBUG"
  9. INFO_LEVEL = "INFO"
  10. WARN_LEVEL = "WARN"
  11. ERROR_LEVEL = "ERROR"
  12. FATAL_LEVEL = "FATAL"
  13. PANIC_LEVEL = "PANIC"
  14. OUTPUT_FILE = "FILE"
  15. OUTPUT_STDOUT = "STDOUT"
  16. )
  17. var loggerLevels = map[string]logrus.Level{
  18. TRACE_LEVEL: logrus.TraceLevel,
  19. DEBUG_LEVEL: logrus.DebugLevel,
  20. INFO_LEVEL: logrus.InfoLevel,
  21. WARN_LEVEL: logrus.WarnLevel,
  22. ERROR_LEVEL: logrus.ErrorLevel,
  23. FATAL_LEVEL: logrus.FatalLevel,
  24. PANIC_LEVEL: logrus.PanicLevel,
  25. }
  26. type Logger interface {
  27. Debug(args ...interface{})
  28. Debugf(format string, args ...interface{})
  29. Info(args ...interface{})
  30. Infof(format string, args ...interface{})
  31. Warn(args ...interface{})
  32. Warnf(format string, args ...interface{})
  33. Error(args ...interface{})
  34. Errorf(format string, args ...interface{})
  35. Fatal(args ...interface{})
  36. Fatalf(format string, args ...interface{})
  37. Panic(args ...interface{})
  38. Panicf(format string, args ...interface{})
  39. WithField(key string, val any) Logger
  40. WithType(key string, typ reflect.Type) Logger
  41. }

公共库

Contributors (1)