config_logger.go 417 B

12345678910111213141516171819202122
  1. package config
  2. import "github.com/natefinch/lumberjack"
  3. var (
  4. _loggerConfig *LoggerConfig
  5. )
  6. type LoggerConfig struct {
  7. Level string `yaml:"level,omitempty"`
  8. Lumberjack *lumberjack.Logger `yaml:"lumberjack,omitempty"`
  9. }
  10. func InitLogger(path string) {
  11. var config LoggerConfig
  12. readConfig(path, &config)
  13. _loggerConfig = &config
  14. }
  15. func GetLoggerConfig() LoggerConfig {
  16. return *_loggerConfig
  17. }