2022-07-12 07:17:29 +00:00
|
|
|
package log
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
var std ContextLogger
|
|
|
|
|
|
|
|
func init() {
|
2023-12-04 03:47:25 +00:00
|
|
|
std = NewDefaultFactory(
|
|
|
|
context.Background(),
|
|
|
|
Formatter{BaseTime: time.Now()},
|
|
|
|
os.Stderr,
|
|
|
|
"",
|
|
|
|
nil,
|
|
|
|
false,
|
|
|
|
).Logger()
|
2022-07-12 07:17:29 +00:00
|
|
|
}
|
|
|
|
|
2022-07-29 16:29:22 +00:00
|
|
|
func StdLogger() ContextLogger {
|
|
|
|
return std
|
|
|
|
}
|
|
|
|
|
2023-03-13 03:23:00 +00:00
|
|
|
func SetStdLogger(logger ContextLogger) {
|
|
|
|
std = logger
|
|
|
|
}
|
|
|
|
|
2022-07-12 07:17:29 +00:00
|
|
|
func Trace(args ...any) {
|
|
|
|
std.Trace(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Debug(args ...any) {
|
|
|
|
std.Debug(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Info(args ...any) {
|
|
|
|
std.Info(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Warn(args ...any) {
|
|
|
|
std.Warn(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Error(args ...any) {
|
|
|
|
std.Error(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Fatal(args ...any) {
|
|
|
|
std.Fatal(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Panic(args ...any) {
|
|
|
|
std.Panic(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TraceContext(ctx context.Context, args ...any) {
|
|
|
|
std.TraceContext(ctx, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func DebugContext(ctx context.Context, args ...any) {
|
|
|
|
std.DebugContext(ctx, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func InfoContext(ctx context.Context, args ...any) {
|
|
|
|
std.InfoContext(ctx, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func WarnContext(ctx context.Context, args ...any) {
|
|
|
|
std.WarnContext(ctx, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func ErrorContext(ctx context.Context, args ...any) {
|
|
|
|
std.ErrorContext(ctx, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func FatalContext(ctx context.Context, args ...any) {
|
|
|
|
std.FatalContext(ctx, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func PanicContext(ctx context.Context, args ...any) {
|
|
|
|
std.PanicContext(ctx, args...)
|
|
|
|
}
|