LogPrintln.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package logs
  2. import (
  3. "ColdVerify_local/conf"
  4. "github.com/astaxie/beego/logs"
  5. )
  6. var Logx *logs.BeeLogger
  7. func init() {
  8. Logx = logs.NewLogger()
  9. Logx.SetLogger(logs.AdapterFile, `{"filename":"logs/Logx/Logx.log"}`)
  10. Logx.SetLevel(logs.LevelDebug)
  11. Logx.EnableFuncCallDepth(true)
  12. Logx.SetLogFuncCallDepth(3)
  13. if conf.RunMode == "dev" {
  14. Logx.SetLogger(logs.AdapterConsole, `{"filename":"logs/console/console.log"}`)
  15. }
  16. }
  17. func Println(format string, v ...interface{}) {
  18. for _, _ = range v {
  19. format += " %v"
  20. }
  21. Logx.Info(format, v...)
  22. }
  23. // Debug Log DEBUG level message.
  24. func Debug(format string, v ...interface{}) {
  25. for _, _ = range v {
  26. format += " %v"
  27. }
  28. Logx.Debug(format, v...)
  29. }
  30. // Info Log ERROR level message.
  31. func Info(format string, v ...interface{}) {
  32. for _, _ = range v {
  33. format += " %v"
  34. }
  35. Logx.Info(format, v...)
  36. }
  37. // Error Log ERROR level message.
  38. func Error(format string, v ...interface{}) {
  39. for _, _ = range v {
  40. format += " %v"
  41. }
  42. Logx.Error(format, v...)
  43. }
  44. // Warning Log WARNING level message.
  45. func Warning(format string, v ...interface{}) {
  46. for _, _ = range v {
  47. format += " %v"
  48. }
  49. Logx.Warning(format, v...)
  50. }