package log

import (
	"context"

	plog "github.com/pingcap/log"
	"go.uber.org/zap"
)

func Debug(ctx context.Context, msg string, fields ...zap.Field) {
	WithContextL(ctx).WithOptions(zap.AddCallerSkip(1)).Debug(msg, fields...)
}

func Info(ctx context.Context, msg string, fields ...zap.Field) {
	WithContextL(ctx).WithOptions(zap.AddCallerSkip(1)).Info(msg, fields...)
}

func Warn(ctx context.Context, msg string, fields ...zap.Field) {
	WithContextL(ctx).WithOptions(zap.AddCallerSkip(1)).Warn(msg, fields...)
}

func Error(ctx context.Context, msg string, fields ...zap.Field) {
	WithContextL(ctx).WithOptions(zap.AddCallerSkip(1)).Error(msg, fields...)
}

func Fatal(ctx context.Context, msg string, fields ...zap.Field) {
	WithContextL(ctx).WithOptions(zap.AddCallerSkip(1)).Fatal(msg, fields...)
}

func With(fields ...zap.Field) *zap.Logger {
	return plog.L().With(fields...)
}

func PlainDebug(msg string, fields ...zap.Field) {
	plog.L().WithOptions(zap.AddCallerSkip(1)).Debug(msg, fields...)
}

func PlainInfo(msg string, fields ...zap.Field) {
	plog.L().WithOptions(zap.AddCallerSkip(1)).Info(msg, fields...)
}

func PlainWarn(msg string, fields ...zap.Field) {
	plog.L().WithOptions(zap.AddCallerSkip(1)).Warn(msg, fields...)
}

func PlainError(msg string, fields ...zap.Field) {
	plog.L().WithOptions(zap.AddCallerSkip(1)).Error(msg, fields...)
}
