init.go 540 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "field-dispose/config"
  4. "fmt"
  5. "jygit.jydev.jianyu360.cn/data_processing/common_utils/log"
  6. "os"
  7. )
  8. // InitLog @Description
  9. // @Author J 2022/7/26 15:30
  10. func InitLog() {
  11. logcfg := config.Conf.Log
  12. err := log.InitLog(
  13. log.Path(logcfg.LogPath),
  14. log.Level(logcfg.LogLevel),
  15. log.Compress(logcfg.Compress),
  16. log.MaxSize(logcfg.MaxSize),
  17. log.MaxBackups(logcfg.MaxBackups),
  18. log.MaxAge(logcfg.MaxAge),
  19. log.Format(logcfg.Format),
  20. )
  21. if err != nil {
  22. fmt.Printf("InitLog failed: %v\n", err)
  23. os.Exit(1)
  24. }
  25. }