feat: complete contract-driven business development and MySQL integration

This commit is contained in:
2026-09-24 21:56:04 +08:00
parent f9afb8f8dd
commit f5478cdc76
108 changed files with 6557 additions and 550 deletions

View File

@@ -73,7 +73,7 @@ func init() {
// call Close when the process is shutting down.
func New(cfg Config) (*Logger, error) {
cfg = normalizeConfig(cfg)
if err := cfg.Rotation.validate(cfg); err != nil {
if err := cfg.Validate(); err != nil {
return nil, err
}
level, err := parseLevel(cfg.Level)
@@ -225,7 +225,7 @@ func (l *Logger) ErrorStackContext(ctx context.Context, msg string, args ...any)
}
func ErrorStackContext(ctx context.Context, msg string, args ...any) {
defaultLogger.Load().ErrorStackContext(ctx, msg, args...)
FromContext(ctx).ErrorStackContext(ctx, msg, args...)
}
func (l *Logger) Debug(msg string, args ...any) { l.DebugContext(context.Background(), msg, args...) }
@@ -234,19 +234,19 @@ func (l *Logger) Warn(msg string, args ...any) { l.WarnContext(context.Backgrou
func (l *Logger) Error(msg string, args ...any) { l.ErrorContext(context.Background(), msg, args...) }
func DebugContext(ctx context.Context, msg string, args ...any) {
defaultLogger.Load().DebugContext(ctx, msg, args...)
FromContext(ctx).DebugContext(ctx, msg, args...)
}
func InfoContext(ctx context.Context, msg string, args ...any) {
defaultLogger.Load().InfoContext(ctx, msg, args...)
FromContext(ctx).InfoContext(ctx, msg, args...)
}
func WarnContext(ctx context.Context, msg string, args ...any) {
defaultLogger.Load().WarnContext(ctx, msg, args...)
FromContext(ctx).WarnContext(ctx, msg, args...)
}
func ErrorContext(ctx context.Context, msg string, args ...any) {
defaultLogger.Load().ErrorContext(ctx, msg, args...)
FromContext(ctx).ErrorContext(ctx, msg, args...)
}
func Debug(msg string, args ...any) { DebugContext(context.Background(), msg, args...) }