logger.go 584 B

123456789101112131415161718192021222324252627
  1. package config
  2. import "github.com/spf13/viper"
  3. type Logger struct {
  4. Path string
  5. Level string
  6. Stdout bool
  7. EnabledBUS bool
  8. EnabledREQ bool
  9. EnabledDB bool
  10. EnabledJOB bool `default:"false"`
  11. }
  12. func InitLog(cfg *viper.Viper) *Logger {
  13. return &Logger{
  14. Path: cfg.GetString("path"),
  15. Level: cfg.GetString("level"),
  16. Stdout: cfg.GetBool("stdout"),
  17. EnabledBUS: cfg.GetBool("enabledbus"),
  18. EnabledREQ: cfg.GetBool("enabledreq"),
  19. EnabledDB: cfg.GetBool("enableddb"),
  20. EnabledJOB: cfg.GetBool("enabledjob"),
  21. }
  22. }
  23. var LoggerConfig = new(Logger)