logging

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command added in v0.7.0

func Command(ctx context.Context, cfg CommandLogger, name string, arg ...string) *exec.Cmd

func GetLogger added in v0.7.0

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

func NewLoggerWriter added in v0.7.0

func NewLoggerWriter(logger *zap.Logger, level zapcore.Level) io.Writer

func TimeOffsetFormatter added in v0.7.0

func TimeOffsetFormatter(start time.Time, color bool) zapcore.TimeEncoder

TimeOffsetFormatter returns a time encoder that formats the time as an offset from the start time. This is mostly useful for CLI logging not long-standing services as times beyond a few minutes will be less readable.

func WithLogger added in v0.7.0

func WithLogger(ctx context.Context, logger *zap.Logger) context.Context

Types

type CategoryWriter added in v0.7.0

type CategoryWriter struct {
	Encoder     zapcore.Encoder
	LogRootPath string
	// contains filtered or unexported fields
}

func NewCategoryWriter added in v0.7.0

func NewCategoryWriter(enc zapcore.Encoder, logRootPath string) *CategoryWriter

func (*CategoryWriter) Check added in v0.7.0

func (*CategoryWriter) Enabled added in v0.7.0

func (c *CategoryWriter) Enabled(lvl zapcore.Level) bool

func (*CategoryWriter) Sync added in v0.7.0

func (c *CategoryWriter) Sync() error

func (*CategoryWriter) With added in v0.7.0

func (c *CategoryWriter) With(fields []zapcore.Field) zapcore.Core

func (*CategoryWriter) Write added in v0.7.0

func (c *CategoryWriter) Write(ent zapcore.Entry, fields []zapcore.Field) error

type CommandLogger added in v0.7.0

type CommandLogger struct {
	RootLogger  *zap.Logger
	StdoutLevel zapcore.Level
	StderrLevel zapcore.Level
}

type EntryLeveller added in v0.7.0

type EntryLeveller struct {
	zapcore.Core
	// contains filtered or unexported fields
}

EntryLeveller is a zapcore.Core that filters log entries based on the module name similar to Log4j or python's logging module.

func NewEntryLeveller added in v0.7.0

func NewEntryLeveller(core zapcore.Core, levels map[string]zapcore.Level) *EntryLeveller

func (*EntryLeveller) Check added in v0.7.0

func (*EntryLeveller) With added in v0.7.0

func (el *EntryLeveller) With(f []zapcore.Field) zapcore.Core

type LogOpts added in v0.7.0

type LogOpts struct {
	Verbose         bool
	Color           string
	CategoryLogsDir string
	Encoding        string
	DefaultLevels   map[string]zapcore.Level
}

func (LogOpts) CategoryCore added in v0.7.0

func (opts LogOpts) CategoryCore(core zapcore.Core) zapcore.Core

func (LogOpts) Encoder added in v0.7.0

func (opts LogOpts) Encoder() zapcore.Encoder

func (LogOpts) EntryLeveller added in v0.7.0

func (opts LogOpts) EntryLeveller(core zapcore.Core) zapcore.Core

func (LogOpts) NewCore added in v0.7.0

func (opts LogOpts) NewCore(w zapcore.WriteSyncer) zapcore.Core

func (LogOpts) NewLogger added in v0.7.0

func (opts LogOpts) NewLogger() *zap.Logger

Jump to

Keyboard shortcuts

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