glog_api.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package glog
  7. import "context"
  8. // Print prints `v` with newline using fmt.Sprintln.
  9. // The parameter `v` can be multiple variables.
  10. func Print(ctx context.Context, v ...interface{}) {
  11. defaultLogger.Print(ctx, v...)
  12. }
  13. // Printf prints `v` with format `format` using fmt.Sprintf.
  14. // The parameter `v` can be multiple variables.
  15. func Printf(ctx context.Context, format string, v ...interface{}) {
  16. defaultLogger.Printf(ctx, format, v...)
  17. }
  18. // Fatal prints the logging content with [FATA] header and newline, then exit the current process.
  19. func Fatal(ctx context.Context, v ...interface{}) {
  20. defaultLogger.Fatal(ctx, v...)
  21. }
  22. // Fatalf prints the logging content with [FATA] header, custom format and newline, then exit the current process.
  23. func Fatalf(ctx context.Context, format string, v ...interface{}) {
  24. defaultLogger.Fatalf(ctx, format, v...)
  25. }
  26. // Panic prints the logging content with [PANI] header and newline, then panics.
  27. func Panic(ctx context.Context, v ...interface{}) {
  28. defaultLogger.Panic(ctx, v...)
  29. }
  30. // Panicf prints the logging content with [PANI] header, custom format and newline, then panics.
  31. func Panicf(ctx context.Context, format string, v ...interface{}) {
  32. defaultLogger.Panicf(ctx, format, v...)
  33. }
  34. // Info prints the logging content with [INFO] header and newline.
  35. func Info(ctx context.Context, v ...interface{}) {
  36. defaultLogger.Info(ctx, v...)
  37. }
  38. // Infof prints the logging content with [INFO] header, custom format and newline.
  39. func Infof(ctx context.Context, format string, v ...interface{}) {
  40. defaultLogger.Infof(ctx, format, v...)
  41. }
  42. // Debug prints the logging content with [DEBU] header and newline.
  43. func Debug(ctx context.Context, v ...interface{}) {
  44. defaultLogger.Debug(ctx, v...)
  45. }
  46. // Debugf prints the logging content with [DEBU] header, custom format and newline.
  47. func Debugf(ctx context.Context, format string, v ...interface{}) {
  48. defaultLogger.Debugf(ctx, format, v...)
  49. }
  50. // Notice prints the logging content with [NOTI] header and newline.
  51. // It also prints caller stack info if stack feature is enabled.
  52. func Notice(ctx context.Context, v ...interface{}) {
  53. defaultLogger.Notice(ctx, v...)
  54. }
  55. // Noticef prints the logging content with [NOTI] header, custom format and newline.
  56. // It also prints caller stack info if stack feature is enabled.
  57. func Noticef(ctx context.Context, format string, v ...interface{}) {
  58. defaultLogger.Noticef(ctx, format, v...)
  59. }
  60. // Warning prints the logging content with [WARN] header and newline.
  61. // It also prints caller stack info if stack feature is enabled.
  62. func Warning(ctx context.Context, v ...interface{}) {
  63. defaultLogger.Warning(ctx, v...)
  64. }
  65. // Warningf prints the logging content with [WARN] header, custom format and newline.
  66. // It also prints caller stack info if stack feature is enabled.
  67. func Warningf(ctx context.Context, format string, v ...interface{}) {
  68. defaultLogger.Warningf(ctx, format, v...)
  69. }
  70. // Error prints the logging content with [ERRO] header and newline.
  71. // It also prints caller stack info if stack feature is enabled.
  72. func Error(ctx context.Context, v ...interface{}) {
  73. defaultLogger.Error(ctx, v...)
  74. }
  75. // Errorf prints the logging content with [ERRO] header, custom format and newline.
  76. // It also prints caller stack info if stack feature is enabled.
  77. func Errorf(ctx context.Context, format string, v ...interface{}) {
  78. defaultLogger.Errorf(ctx, format, v...)
  79. }
  80. // Critical prints the logging content with [CRIT] header and newline.
  81. // It also prints caller stack info if stack feature is enabled.
  82. func Critical(ctx context.Context, v ...interface{}) {
  83. defaultLogger.Critical(ctx, v...)
  84. }
  85. // Criticalf prints the logging content with [CRIT] header, custom format and newline.
  86. // It also prints caller stack info if stack feature is enabled.
  87. func Criticalf(ctx context.Context, format string, v ...interface{}) {
  88. defaultLogger.Criticalf(ctx, format, v...)
  89. }