LogPrintln.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package logs
  2. import (
  3. "ERP_ams/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. for _, _ = range v {
  25. format += " %v"
  26. }
  27. Logx.Info(format, v...)
  28. }
  29. // Debug Log DEBUG level message.
  30. func Debug(format string, v ...interface{}) {
  31. for _, _ = range v {
  32. format += " %v"
  33. }
  34. Logx.Debug(format, v...)
  35. }
  36. // Info Log ERROR level message.
  37. func Info(format string, v ...interface{}) {
  38. for _, _ = range v {
  39. format += " %v"
  40. }
  41. Logx.Info(format, v...)
  42. }
  43. // Error Log ERROR level message.
  44. func Error(format string, v ...interface{}) {
  45. for _, _ = range v {
  46. format += " %v"
  47. }
  48. Logx.Error(format, v...)
  49. }
  50. // Warning Log WARNING level message.
  51. func Warning(format string, v ...interface{}) {
  52. for _, _ = range v {
  53. format += " %v"
  54. }
  55. Logx.Warning(format, v...)
  56. }