LogPrintln.go 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package logs
  2. import (
  3. "Cold_WorkOrder/conf"
  4. "github.com/astaxie/beego/logs"
  5. "runtime"
  6. )
  7. var logx *logs.BeeLogger
  8. var Test = true
  9. func init() {
  10. logx = logs.NewLogger()
  11. logx.SetLogger(logs.AdapterFile, `{"filename":"logs/logx/logx.log"}`)
  12. logx.EnableFuncCallDepth(true)
  13. logx.SetLogFuncCallDepth(3)
  14. if conf.RunMode == "dev" {
  15. logx.SetLogger("console")
  16. }
  17. if runtime.GOOS == "windows" {
  18. Test = true
  19. } else {
  20. Test = false
  21. }
  22. }
  23. func Println(format string, v ...interface{}) {
  24. logx.Info(format, v...)
  25. }
  26. // Debug Log DEBUG level message.
  27. func Debug(format string, v ...interface{}) {
  28. logx.Debug(format, v...)
  29. }
  30. // Info Log ERROR level message.
  31. func Info(format string, v ...interface{}) {
  32. logx.Info(format, v...)
  33. }
  34. // Error Log ERROR level message.
  35. func Error(format string, v ...interface{}) {
  36. logx.Error(format, v...)
  37. }
  38. // Warning Log WARNING level message.
  39. func Warning(format string, v ...interface{}) {
  40. logx.Warning(format, v...)
  41. }