Documentation
¶
Index ¶
- func Always(msg string, fields ...zap.Field)
- func C(ctx context.Context) *zap.Logger
- func CDebug(ctx context.Context, msg string, fields ...zap.Field)
- func CError(ctx context.Context, msg string, fields ...zap.Field)
- func CInfo(ctx context.Context, msg string, fields ...zap.Field)
- func CWarn(ctx context.Context, msg string, fields ...zap.Field)
- func Debug(msg string, fields ...zap.Field)
- func Debugf(template string, args ...interface{})
- func Error(msg string, fields ...zap.Field)
- func Errorf(template string, args ...interface{})
- func Fatal(msg string, fields ...zap.Field)
- func Fatalf(template string, args ...interface{})
- func Info(msg string, fields ...zap.Field)
- func Infof(template string, args ...interface{})
- func Init(cfg *Config) error
- func L() *zap.Logger
- func MaskEmail(email string) string
- func MaskIDCard(id string) string
- func MaskPhone(phone string) string
- func MaskSecret(secret string) string
- func MaskSecretWithPrefix(secret string) string
- func ReplaceGlobals(logger *zap.Logger)
- func S() *zap.SugaredLogger
- func Sync()
- func Warn(msg string, fields ...zap.Field)
- func Warnf(template string, args ...interface{})
- type Config
- type ErrorWriter
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf logs a message at DebugLevel with formatting
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf logs a message at ErrorLevel with formatting
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf logs a message at FatalLevel with formatting
func Infof ¶
func Infof(template string, args ...interface{})
Infof logs a message at InfoLevel with formatting
func MaskIDCard ¶
MaskIDCard masks an ID card: 110101199001011234 -> 110***********1234
func MaskSecret ¶
MaskSecret completely hides a secret, showing only prefix/suffix hint if requested, or just generic mask. Default: ******
func MaskSecretWithPrefix ¶
MaskSecretWithPrefix shows first 2 chars: "ab******"
func ReplaceGlobals ¶
ReplaceGlobals replaces the global logger
Types ¶
type Config ¶
type Config struct {
Level string
Format string
OutputPaths []string // For non-rotation outputs like stdout
EnableRotation bool
RotateLogPath string
MaxSize int
MaxBackups int
MaxAge int
Compress bool
}
Init initializes the global logger For MVP, we stick to NewProduction or NewDevelopment based on a simple toggle, or just standard Production for now. Config defines log configuration
type ErrorWriter ¶
type ErrorWriter struct{}
ErrorWriter writes to Error level
func NewGinErrorWriter ¶
func NewGinErrorWriter() *ErrorWriter
NewGinErrorWriter returns an io.Writer that logs via zap Error