zap

package
v0.0.0-...-206b492 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Level   zap.AtomicLevel
	Datadog struct {
		Service string

		Environment string
		// contains filtered or unexported fields
	}
}

Config is the configuration struct for the logger.

type ILogger

type ILogger interface {
	Info(ctx context.Context, msg string, fields ...zap.Field)
	Warn(ctx context.Context, msg string, fields ...zap.Field)
	Debug(ctx context.Context, msg string, fields ...zap.Field)
	Error(ctx context.Context, msg string, fields ...zap.Field)
	Panic(ctx context.Context, msg string, fields ...zap.Field)
	Fatal(ctx context.Context, msg string, fields ...zap.Field)
}

ILogger is the interface that wraps the basic logging methods and automatically adds the datadog fields to the log message. Info, Warn, Debug, Error, Panic, Fatal The base logger is zap logger.

func NewLogger

func NewLogger(cfg *Config) ILogger

NewLogger creates a new instance of the Logger.

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, msg string, fields ...zap.Field)

Debug logs a message at the debug level with Datadog trace and span_id.

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, fields ...zap.Field)

Error logs a message at the error level with Datadog trace and span_id.

func (*Logger) Fatal

func (l *Logger) Fatal(ctx context.Context, msg string, fields ...zap.Field)

Fatal logs a message at the fatal level with Datadog trace and span_id.

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, fields ...zap.Field)

Info logs a message at the info level with Datadog trace and span_id.

func (*Logger) Panic

func (l *Logger) Panic(ctx context.Context, msg string, fields ...zap.Field)

Panic logs a message at the panic level with Datadog trace and span_id.

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, fields ...zap.Field)

Warn logs a message at the warn level with Datadog trace and span_id.

Jump to

Keyboard shortcuts

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