log

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accessf

func Accessf(s string, args ...interface{})

Accessf logs a access entry to the installed logger

func Close

func Close()

func DebugStack

func DebugStack()

func Debugf

func Debugf(s string, args ...interface{})

Debugf logs a debug entry to the installed logger

func Errorf

func Errorf(s string, args ...interface{})

Errorf logs an error entry to the installed logger

func Fatalf

func Fatalf(s string, args ...interface{})

Fatalf logs a fatal entry to the installed logger and panics

func Importantf

func Importantf(s string, args ...interface{})

Warnf logs a warn entry to the installed logger

func Infof

func Infof(s string, args ...interface{})

Infof logs an info entry to the installed logger

func Install

func Install(l Logger)

Install installs the provided Logger as the global logger

func Warnf

func Warnf(s string, args ...interface{})

Warnf logs a warn entry to the installed logger

Types

type DefaultLogger

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

DefaultLogger is the default Logger implementation based on one Writer

func NewDefaultLogger

func NewDefaultLogger(name string, w Writer) *DefaultLogger

NewDefaultLogger creates a new StdLogger

func (*DefaultLogger) Close

func (l *DefaultLogger) Close()

Close closes the writer associated with the logger

func (*DefaultLogger) Log

func (l *DefaultLogger) Log(e entry.Entry)

Log logs writes an entry to the associated logger

type Filter

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

Filter is a writer midlleware for a log-chain

func NewFilter

func NewFilter(accept func(e entry.Entry) bool, next Writer) *Filter

NewFilter creates a new Filter

func (*Filter) Close

func (f *Filter) Close()

Close closes the Filter and all related resources

func (*Filter) Write

func (f *Filter) Write(e entry.Entry)

Write writes to the filter

type Hook

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

Hook specifies a func, which is called before a log-entry is passed to the next writer - mostly used for amending logs entries with additional information

func ComponentHook

func ComponentHook(comp string) *Hook

ComponentHook creates a new hook, which modifies the component field of a log entry

func NewHook

func NewHook(hookFnc func(e entry.Entry) entry.Entry) *Hook

NewHook creates a new hook with the passed hook function

func (*Hook) Accessf

func (lh *Hook) Accessf(s string, args ...interface{})

Accessf logs an access entry

func (*Hook) Debugf

func (lh *Hook) Debugf(s string, args ...interface{})

Debugf logs a debug entry

func (*Hook) Errorf

func (lh *Hook) Errorf(s string, args ...interface{})

Errorf logs an error entry

func (*Hook) Fatalf

func (lh *Hook) Fatalf(s string, args ...interface{})

Fatalf logs a fatla entry and panics

func (*Hook) Importantf

func (lh *Hook) Importantf(s string, args ...interface{})

Importantf logs an important entry

func (*Hook) Infof

func (lh *Hook) Infof(s string, args ...interface{})

Infof logs an info entry

func (*Hook) Warnf

func (lh *Hook) Warnf(s string, args ...interface{})

Warnf logs a warn entry

type Logger

type Logger interface {
	Log(e entry.Entry)
	Close()
}

Logger defines the general logger interface

type MultiWriter

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

MultiWriter implements the Writer interface it provides a logger middleware which writes to multiple next writers

func NewMultiWriter

func NewMultiWriter(targets ...Writer) *MultiWriter

NewMultiWriter creates a new MultiWriter

func (*MultiWriter) Close

func (mw *MultiWriter) Close()

Close closes the writer and all related resources

func (*MultiWriter) Write

func (mw *MultiWriter) Write(e entry.Entry)

Write writes an entry to all installed targets

type Writer

type Writer interface {
	Write(e entry.Entry)
	Close()
}

Writer defines the general log-writer interface

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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