2022-07-12 15:17:29 +08:00
|
|
|
package log
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
var std ContextLogger
|
|
|
|
|
|
|
|
func init() {
|
2022-10-25 12:55:00 +08:00
|
|
|
std = NewFactory(Formatter{BaseTime: time.Now()}, os.Stderr, nil).Logger()
|
2022-07-12 15:17:29 +08:00
|
|
|
}
|
|
|
|
|
2022-07-30 00:29:22 +08:00
|
|
|
func StdLogger() ContextLogger {
|
|
|
|
return std
|
|
|
|
}
|
|
|
|
|
2023-03-13 11:23:00 +08:00
|
|
|
func SetStdLogger(logger ContextLogger) {
|
|
|
|
std = logger
|
|
|
|
}
|
|
|
|
|
2022-07-12 15:17:29 +08: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...)
|
|
|
|
}
|