logging

package
v0.0.0-...-a22e99b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Info   printWrapper
	Infof  printfWrapper
	Debug  printWrapper
	Debugf printfWrapper
	Error  printWrapper
	Errorf printfWrapper
	Fatal  printWrapper
	Fatalf printfWrapper
	Panic  printWrapper
	Panicf printfWrapper
	Warn   printWrapper
	Warnf  printfWrapper
)

Functions

func DebugCtx

func DebugCtx(ctx context.Context, message any)

DebugCtx logs a message at level Debug on the logger associated with the context.

func DebugWithDataCtx

func DebugWithDataCtx(ctx context.Context, message any, data any)

DebugWithDataCtx logs a message at level Debug on the logger associated with the context.

func DebugWithFieldCtx

func DebugWithFieldCtx(ctx context.Context, message string, fields ...zap.Field)

DebugWithFieldCtx logs a message at level Debug on the logger associated with the context.

func DebugfCtx

func DebugfCtx(ctx context.Context, template string, args ...any)

DebugfCtx logs a message at level Debug on the logger associated with the context.

func ErrorCtx

func ErrorCtx(ctx context.Context, message any)

ErrorCtx logs a message at level Error on the logger associated with the context.

func ErrorWithDataCtx

func ErrorWithDataCtx(ctx context.Context, message any, data any)

ErrorWithDataCtx logs a message at level Error on the logger associated with the context.

func ErrorWithFieldCtx

func ErrorWithFieldCtx(ctx context.Context, message string, fields ...zap.Field)

ErrorWithFieldCtx logs a message at level Error on the logger associated with the context.

func ErrorfCtx

func ErrorfCtx(ctx context.Context, template string, args ...any)

ErrorfCtx logs a message at level Error on the logger associated with the context.

func FatalCtx

func FatalCtx(ctx context.Context, message any)

FatalCtx logs a message at level Fatal on the logger associated with the context.

func FatalWithDataCtx

func FatalWithDataCtx(ctx context.Context, message any, data any)

FatalWithDataCtx logs a message at level Fatal on the logger associated with the context.

func FatalWithFieldCtx

func FatalWithFieldCtx(ctx context.Context, message string, fields ...zap.Field)

FatalWithFieldCtx logs a message at level Fatal on the logger associated with the context.

func FatalfCtx

func FatalfCtx(ctx context.Context, template string, args ...any)

FatalfCtx logs a message at level Fatal on the logger associated with the context.

func InfoCtx

func InfoCtx(ctx context.Context, message any)

InfoCtx logs a message at level Info on the logger associated with the context.

func InfoWithDataCtx

func InfoWithDataCtx(ctx context.Context, message any, data any)

InfoWithDataCtx logs a message at level Info on the logger associated with the context.

func InfoWithFieldCtx

func InfoWithFieldCtx(ctx context.Context, message string, fields ...zap.Field)

InfoWithFieldCtx logs a message at level Info on the logger associated with the context.

func InfofCtx

func InfofCtx(ctx context.Context, template string, args ...any)

InfofCtx logs a message at level Info on the logger associated with the context.

func Init

func Init(isProd bool)

Init initializes the global logger instance based on the environment and configuration. It sets the log level, chooses between console (development) and JSON (production) encoding, disables timestamps (optional, change if needed), and sets up global convenience functions (Info, Debugf, etc.).

func NewContext

func NewContext(parent context.Context) context.Context

NewContext embeds the global logger instance into a new context. This allows passing the logger implicitly through function calls.

func PanicCtx

func PanicCtx(ctx context.Context, message any)

PanicCtx logs a message at level Panic on the logger associated with the context.

func PanicWithDataCtx

func PanicWithDataCtx(ctx context.Context, message any, data any)

PanicWithDataCtx logs a message at level Panic on the logger associated with the context.

func PanicWithFieldCtx

func PanicWithFieldCtx(ctx context.Context, message string, fields ...zap.Field)

PanicWithFieldCtx logs a message at level Panic on the logger associated with the context.

func PanicfCtx

func PanicfCtx(ctx context.Context, template string, args ...any)

PanicfCtx logs a message at level Panic on the logger associated with the context.

func WarnCtx

func WarnCtx(ctx context.Context, message any)

WarnCtx logs a message at level Warn on the logger associated with the context.

func WarnWithDataCtx

func WarnWithDataCtx(ctx context.Context, message any, data any)

WarnWithDataCtx logs a message at level Warn on the logger associated with the context.

func WarnWithFieldCtx

func WarnWithFieldCtx(ctx context.Context, message string, fields ...zap.Field)

WarnWithFieldCtx logs a message at level Warn on the logger associated with the context.

func WarnfCtx

func WarnfCtx(ctx context.Context, template string, args ...any)

WarnfCtx logs a message at level Warn on the logger associated with the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL