Files
photoview/api/log/default.go
Googol Lee 0da8bef69e Update log for passing attrs with context. (#1216)
* Update log for passing attrs with context.

* Check type-casting

* add tests.

* Use t.Cleanup() to restore the global value.

* Fix error.

* Update tests.

* Add comments.

* Remove cover.cov

* Update doc.

* Update git ignore.
2025-06-07 17:11:50 +02:00

26 lines
590 B
Go

package log
import (
"context"
)
// Debug logs debug messages.
func Debug(ctx context.Context, msg string, args ...any) {
getLogger(ctx).DebugContext(ctx, msg, args...)
}
// Info logs info messages.
func Info(ctx context.Context, msg string, args ...any) {
getLogger(ctx).InfoContext(ctx, msg, args...)
}
// Warn logs warning messages.
func Warn(ctx context.Context, msg string, args ...any) {
getLogger(ctx).WarnContext(ctx, msg, args...)
}
// Error logs error messages.
func Error(ctx context.Context, msg string, args ...any) {
getLogger(ctx).ErrorContext(ctx, msg, args...)
}