logger.go 759 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package logging
  2. import "log/slog"
  3. func Info(msg string, args ...any) {
  4. slog.Info(msg, args...)
  5. }
  6. func Debug(msg string, args ...any) {
  7. slog.Debug(msg, args...)
  8. }
  9. func Warn(msg string, args ...any) {
  10. slog.Warn(msg, args...)
  11. }
  12. func Error(msg string, args ...any) {
  13. slog.Error(msg, args...)
  14. }
  15. func InfoPersist(msg string, args ...any) {
  16. args = append(args, persistKeyArg, true)
  17. slog.Info(msg, args...)
  18. }
  19. func DebugPersist(msg string, args ...any) {
  20. args = append(args, persistKeyArg, true)
  21. slog.Debug(msg, args...)
  22. }
  23. func WarnPersist(msg string, args ...any) {
  24. args = append(args, persistKeyArg, true)
  25. slog.Warn(msg, args...)
  26. }
  27. func ErrorPersist(msg string, args ...any) {
  28. args = append(args, persistKeyArg, true)
  29. slog.Error(msg, args...)
  30. }