logger

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrackIDKey   = "track_id"
	TraceIDKey   = "trace_id"
	SpanIDKey    = "span_id"
	RequestIDKey = "request_id"
	TaskIDKey    = "task_id"
	QueueKey     = "queue"
	TypeKey      = "type"
	RunIDKey     = "run_id"
	JobIDKey     = "job_id"
)
View Source
const KeyLogger runtime.Key = "logger"

Variables

View Source
var (
	L *zap.Logger
)

Functions

func Configure

func Configure(cfg Config) error

func ContextFields

func ContextFields(ctx context.Context) []zap.Field

func Cron

func Cron(name string) cron.Logger

func Ctx

func Ctx(ctx context.Context) *zap.Logger

func Debug

func Debug(msg string, fields ...zap.Field)

func Default

func Default() *zap.Logger

func Error

func Error(msg string, err error, fields ...zap.Field)

func Field

func Field(ctx context.Context, key string) string

Field reads a standard logger field from context.

func From

func From(app *runtime.App) *zap.Logger

func Info

func Info(msg string, fields ...zap.Field)

func Init

func Init(name, level, mode string) error

func Named

func Named(name string) *zap.Logger

func New

func New(name string) (*zap.Logger, error)

func Sync

func Sync()

func Warn

func Warn(msg string, fields ...zap.Field)

func WithContext

func WithContext(ctx context.Context, log *zap.Logger) *zap.Logger

func WithField

func WithField(ctx context.Context, key, value string) context.Context

WithField stores a standard logger field in context.

func WriteSyncer

func WriteSyncer(name, filename string) (zapcore.WriteSyncer, error)

func Writer

func Writer(name, filename string) (io.Writer, error)

Types

type AsynqLogger

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

func Asynq

func Asynq(name string) *AsynqLogger

func (*AsynqLogger) Debug

func (l *AsynqLogger) Debug(args ...interface{})

func (*AsynqLogger) Error

func (l *AsynqLogger) Error(args ...interface{})

func (*AsynqLogger) Fatal

func (l *AsynqLogger) Fatal(args ...interface{})

func (*AsynqLogger) Info

func (l *AsynqLogger) Info(args ...interface{})

func (*AsynqLogger) Warn

func (l *AsynqLogger) Warn(args ...interface{})

type Config

type Config struct {
	Name     string         `mapstructure:"name" yaml:"name"`
	Level    string         `mapstructure:"level" yaml:"level"`
	Mode     string         `mapstructure:"mode" yaml:"mode"`
	Format   string         `mapstructure:"format" yaml:"format"`
	RootDir  string         `mapstructure:"root_dir" yaml:"root_dir"`
	Rotation RotationConfig `mapstructure:"rotation" yaml:"rotation"`
}

type RotationConfig

type RotationConfig struct {
	Mode       string `mapstructure:"mode" yaml:"mode"`
	MaxSize    int    `mapstructure:"max_size" yaml:"max_size"`
	MaxBackups int    `mapstructure:"max_backups" yaml:"max_backups"`
	MaxAge     int    `mapstructure:"max_age" yaml:"max_age"`
	Compress   bool   `mapstructure:"compress" yaml:"compress"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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