mirror of
https://dev.azure.com/schwarzit/schwarzit.stackit-public/_git/audit-go
synced 2026-02-08 09:07:26 +00:00
43 lines
941 B
Go
43 lines
941 B
Go
package log
|
|
|
|
import (
|
|
"errors"
|
|
"log/slog"
|
|
"testing"
|
|
)
|
|
|
|
func Test_SlogLogger(t *testing.T) {
|
|
UseSlogAuditLogger(slog.Default())
|
|
|
|
t.Run("debug", func(t *testing.T) {
|
|
AuditLogger.Debug("debug message")
|
|
})
|
|
|
|
t.Run("debug with error details", func(t *testing.T) {
|
|
AuditLogger.Debug("debug message", errors.New("custom error"))
|
|
})
|
|
|
|
t.Run("info", func(t *testing.T) {
|
|
AuditLogger.Info("info message")
|
|
})
|
|
|
|
t.Run("info with error details", func(t *testing.T) {
|
|
AuditLogger.Info("info message", errors.New("custom error"))
|
|
})
|
|
|
|
t.Run("warn", func(t *testing.T) {
|
|
AuditLogger.Warn("warn message")
|
|
})
|
|
|
|
t.Run("warn with error details", func(t *testing.T) {
|
|
AuditLogger.Warn("warn message", errors.New("custom error"))
|
|
})
|
|
|
|
t.Run("error", func(t *testing.T) {
|
|
AuditLogger.Error("error message")
|
|
})
|
|
|
|
t.Run("error with error details", func(t *testing.T) {
|
|
AuditLogger.Error("error message", errors.New("custom error"))
|
|
})
|
|
}
|