logutil

package
v3.0.0-...-76fd240 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogConfig

type LogConfig struct {
	Level string `mapstructure:"level"`
	File  string `mapstructure:"file"`
}

LogConfig can be use to pass in a set of handlers

type MultiLogHandler

type MultiLogHandler struct {
	SubHandlers []SubLogHandler
	MaxLevel    log.Level
}

func NewMultiLogHandler

func NewMultiLogHandler() (lf *MultiLogHandler)

NewMultiLogHandler provides a new instance of a multi log handler

func (*MultiLogHandler) Close

func (mh *MultiLogHandler) Close()

Close closes the underying streams

func (*MultiLogHandler) HandleLog

func (mh *MultiLogHandler) HandleLog(e *log.Entry) (err error)

HandleLog implements the log.Handler interface.

func (*MultiLogHandler) Open

func (mh *MultiLogHandler) Open(level log.Level, filename string)

Open an (additional) log-handler at the provided level, uses cli-handler when the filename is empty, otherwise uses a text handler

func (*MultiLogHandler) OpenFromConfig

func (mh *MultiLogHandler) OpenFromConfig(lc []LogConfig)

OpenFromConfig will read the logging information from a config structure passed in as parameter

type SubLogHandler

type SubLogHandler struct {
	Handler log.Handler // the wrapped handler
	Level   log.Level   // the minimum level to pass
	Close   func()      // function to call on close
}

SubLogHandler is a handler that filters out logs below a certain level.

Jump to

Keyboard shortcuts

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