log

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPDBFmtLogger

func NewPDBFmtLogger(w io.Writer) kitlog.Logger

NewPDBFmtLogger returns a logger that encodes keyvals to the Writer in paust-db custom format. Note complex types (structs, maps, slices) formatted as "%+v".

Each log event produces no more than one call to w.Write. The passed Writer must be safe for concurrent use by multiple goroutines if the returned Logger will be used concurrently.

func NewSyncWriter

func NewSyncWriter(w io.Writer) io.Writer

NewSyncWriter returns a new writer that is safe for concurrent use by multiple goroutines. Writes to the returned writer are passed on to w. If another write is already in progress, the calling goroutine blocks until the writer is available.

If w implements the following interface, so does the returned writer.

interface {
    Fd() uintptr
}

Types

type Logger

type Logger interface {
	Debug(msg string, keyvals ...interface{})
	Info(msg string, keyvals ...interface{})
	Error(msg string, keyvals ...interface{})

	With(keyvals ...interface{}) Logger
}

func NewFilter

func NewFilter(next Logger, options ...Option) Logger

NewFilter wraps next and implements filtering. See the commentary on the Option functions for a detailed description of how to configure levels. If no options are provided, all leveled log events created with Debug, Info or Error helper methods are squelched.

func NewPDBLogger

func NewPDBLogger(w io.Writer) Logger

NewPDBLogger returns a logger that encodes msg and keyvals to the Writer using go-kit's log as an underlying logger and our custom formatter. Note that underlying logger could be swapped with something else.

type Option

type Option func(*filter)

Option sets a parameter for the filter.

func AllowAll

func AllowAll() Option

AllowAll is an alias for AllowDebug.

func AllowDebug

func AllowDebug() Option

AllowDebug allows error, info and debug level log events to pass.

func AllowError

func AllowError() Option

AllowError allows only error level log events to pass.

func AllowInfo

func AllowInfo() Option

AllowInfo allows error and info level log events to pass.

func AllowLevel

func AllowLevel(lvl string) (Option, error)

AllowLevel returns an option for the given level or error if no option exist for such level.

func AllowNone

func AllowNone() Option

AllowNone allows no leveled log events to pass.

Jump to

Keyboard shortcuts

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