log

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: AGPL-3.0 Imports: 8 Imported by: 47

Documentation

Overview

Package log provides a logging backend, based around the go-logging package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	logging.LeveledBackend
	sync.RWMutex
	// contains filtered or unexported fields
}

Backend is a log backend.

func New

func New(f string, level string, disable bool) (*Backend, error)

New initializes a logging backend.

func (*Backend) GetGoLogger

func (b *Backend) GetGoLogger(module string, level string) *goLog.Logger

GetGoLogger returns a per-module Go runtime *log.Logger that writes to the backend. Due to limitations of the Go runtime log package, only one level is supported per returned Logger.

func (*Backend) GetLevel added in v0.0.2

func (b *Backend) GetLevel(level string) logging.Level

GetLevel returns the logging level for the specified module as per the logging.Leveled interface.

func (*Backend) GetLogWriter

func (b *Backend) GetLogWriter(module string, level string) io.Writer

GetLogWriter returns a per-module io.Writer that writes to the backend at the provided level.

func (*Backend) GetLogger

func (b *Backend) GetLogger(module string) *logging.Logger

GetLogger returns a per-module logger that writes to the backend.

func (*Backend) IsEnabledFor added in v0.0.2

func (b *Backend) IsEnabledFor(level logging.Level, module string) bool

IsEnabledFor returns true if the logger is enabled for the given level. We use this function as part of our implementation of the logging.Leveled interface.

func (*Backend) Log added in v0.0.2

func (b *Backend) Log(level logging.Level, calldepth int, record *logging.Record) error

Log is used to log a message as per the logging.Backend interface.

func (*Backend) Rotate added in v0.0.2

func (b *Backend) Rotate() error

Rotate simply reopens the log file for writing and should be used to implement log rotation where this is invoked upon HUP signal for example.

func (*Backend) SetLevel added in v0.0.2

func (b *Backend) SetLevel(level logging.Level, module string)

SetLevel sets the logging level for the specified module. The module corresponds to the string specified in GetLogger. We use this function as part of our implementation of the logging.Leveled interface.

Jump to

Keyboard shortcuts

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