logconfig

package
v0.0.0-...-c97221a Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentLogOptions = LogOptions{
	LogLevel: zerolog.DebugLevel,
	LogHTTP:  false,
}

CurrentLogOptions stores global LogOptions.

Functions

func Bootstrap

func Bootstrap()

Bootstrap configures logger defaults (console).

func Configure

func Configure(opts *LogOptions)

Configure configures logger using app config (console + file, level).

func SetLogLevel

func SetLogLevel(level zerolog.Level)

SetLogLevel sets global log level to the given one.

Types

type Collector

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

Collector collects node logs.

func NewCollector

func NewCollector(options *LogOptions) *Collector

NewCollector creates a Collector instance.

func (*Collector) Archive

func (c *Collector) Archive() (outputFilepath string, err error)

Archive creates ZIP archive containing all node log files.

type LogCapturer

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

LogCapturer captures logging messages to an in-memory slice for accessing later. Typical use case is asserting certain log messages in tests.

func NewLogCapturer

func NewLogCapturer() *LogCapturer

NewLogCapturer creates a LogCapturer.

func (*LogCapturer) Attach

func (l *LogCapturer) Attach()

Attach attaches LogCapturer hook to the global zerolog instance.

func (*LogCapturer) Detach

func (l *LogCapturer) Detach()

Detach restores original global zerolog instance.

func (*LogCapturer) Messages

func (l *LogCapturer) Messages() []string

Messages returns all captures log messages.

func (*LogCapturer) Run

func (l *LogCapturer) Run(e *zerolog.Event, level zerolog.Level, message string)

Run appends log message to an in-memory slice (zerolog hook).

type LogOptions

type LogOptions struct {
	LogLevel zerolog.Level
	LogHTTP  bool
	Filepath string
}

LogOptions describes logging options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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