logger

package module
Version: v0.0.0-...-da6d343 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 12 Imported by: 6

README

logger

A FAIRE.

Go Report Card Go Reference

Licence

MIT.


Copyright (c) 2021-2022 losyme

Documentation

Index

Constants

View Source
const (
	LevelTrace = iota + 1
	LevelDebug
	LevelInfo
	LevelNotice
	LevelWarning
	LevelError
	LevelFatal
)

Variables

View Source
var BufPool = buffer.NewPool(_bufSize)

Functions

func Start

func Start()

func Stop

func Stop()

Types

type Level

type Level uint32

func StringToLevel

func StringToLevel(level string) Level

func (Level) String

func (l Level) String() string

type Log

type Log struct {
	Time   time.Time
	Logger *Logger
	Level  Level
	Msg    string
	KV     []interface{}
}

type Logger

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

func New

func New(id, name, level string, output Output) (*Logger, error)

func (*Logger) Debug

func (l *Logger) Debug(msg string, kv ...interface{})

func (*Logger) Error

func (l *Logger) Error(msg string, kv ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, kv ...interface{})

func (*Logger) ID

func (l *Logger) ID() string

func (*Logger) Info

func (l *Logger) Info(msg string, kv ...interface{})

func (*Logger) Label

func (l *Logger) Label() string

func (*Logger) Level

func (l *Logger) Level() string

func (*Logger) Log

func (l *Logger) Log(level Level, msg string, kv ...interface{})

func (*Logger) Name

func (l *Logger) Name() string

func (*Logger) NewLogger

func (l *Logger) NewLogger(id, name string) (*Logger, error)

func (*Logger) NewStdLogger

func (l *Logger) NewStdLogger(level, prefix string, flag int) *log.Logger

func (*Logger) Notice

func (l *Logger) Notice(msg string, kv ...interface{})

func (*Logger) SetLevel

func (l *Logger) SetLevel(level string)

func (*Logger) Trace

func (l *Logger) Trace(msg string, kv ...interface{})

func (*Logger) Unregister

func (l *Logger) Unregister()

func (*Logger) Warning

func (l *Logger) Warning(msg string, kv ...interface{})

type Output

type Output interface {
	Log(e *Log) error
	Close() error
}

func NewStderrOutput

func NewStderrOutput() Output

func NewStdoutOutput

func NewStdoutOutput() Output

func NewSyslogOutput

func NewSyslogOutput(app, facility string) (Output, error)

Jump to

Keyboard shortcuts

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