core: Index | Files

package log

import ""

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


Package Files


type Backend Uses

type Backend struct {
    // contains filtered or unexported fields

Backend is a log backend.

func New Uses

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

New initializes a logging backend.

func (*Backend) GetGoLogger Uses

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 Uses

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 Uses

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 Uses

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

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

func (*Backend) IsEnabledFor Uses

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 Uses

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 Uses

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 Uses

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.

Package log imports 8 packages (graph) and is imported by 18 packages. Updated 2018-09-30. Refresh now. Tools for package owners.