SuperCoder/internal/logging/logger.go

40 lines
759 B
Go
Raw Normal View History

2025-03-21 18:20:28 +01:00
package logging
2025-04-10 13:29:44 +02:00
import "log/slog"
2025-03-21 18:20:28 +01:00
2025-04-10 13:29:44 +02:00
func Info(msg string, args ...any) {
slog.Info(msg, args...)
2025-03-21 18:20:28 +01:00
}
2025-04-10 13:29:44 +02:00
func Debug(msg string, args ...any) {
slog.Debug(msg, args...)
2025-03-21 18:20:28 +01:00
}
2025-04-10 13:29:44 +02:00
func Warn(msg string, args ...any) {
slog.Warn(msg, args...)
2025-03-21 18:20:28 +01:00
}
2025-04-10 13:29:44 +02:00
func Error(msg string, args ...any) {
slog.Error(msg, args...)
2025-04-09 19:07:39 +02:00
}
2025-04-10 13:29:44 +02:00
func InfoPersist(msg string, args ...any) {
2025-04-09 19:07:39 +02:00
args = append(args, persistKeyArg, true)
2025-04-10 13:29:44 +02:00
slog.Info(msg, args...)
2025-04-09 19:07:39 +02:00
}
2025-04-10 13:29:44 +02:00
func DebugPersist(msg string, args ...any) {
2025-04-09 19:07:39 +02:00
args = append(args, persistKeyArg, true)
2025-04-10 13:29:44 +02:00
slog.Debug(msg, args...)
2025-04-09 19:07:39 +02:00
}
2025-04-10 13:29:44 +02:00
func WarnPersist(msg string, args ...any) {
2025-04-09 19:07:39 +02:00
args = append(args, persistKeyArg, true)
2025-04-10 13:29:44 +02:00
slog.Warn(msg, args...)
2025-04-09 19:07:39 +02:00
}
2025-04-10 13:29:44 +02:00
func ErrorPersist(msg string, args ...any) {
2025-04-09 19:07:39 +02:00
args = append(args, persistKeyArg, true)
2025-04-10 13:29:44 +02:00
slog.Error(msg, args...)
2025-03-21 18:20:28 +01:00
}