logger

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) *zap.SugaredLogger

FromContext retrieves the logger from the context.

func InitLogger

func InitLogger(debug bool, jsonFormat bool)

InitLogger initializes the logger with a specified log level and format (JSON or console).

func LogDebug

func LogDebug(ctx context.Context, msg string, keysAndValues ...interface{})

LogDebug logs debug messages if debug mode is enabled.

func LogError

func LogError(ctx context.Context, err error, msg string, keysAndValues ...interface{})

LogError logs an error message with optional key-value pairs for structured logging.

func LogInfo

func LogInfo(ctx context.Context, msg string, keysAndValues ...interface{})

LogInfo logs informational messages.

func Sync

func Sync()

Sync flushes any buffered log entries.

func WithLogger

func WithLogger(ctx context.Context) context.Context

WithLogger attaches the logger to 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