logger

package
v0.0.0-...-04c5af6 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

README

logger

基于标准库增加上下文等信息的logger

Required Go1.8+

Documentation

Index

Constants

View Source
const (
	ERROR = iota
	INFO
	SQL
	DEBUG
)

Variables

This section is empty.

Functions

func AccessLog

func AccessLog(format string, args ...interface{})

func Debugf

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

func Debugln

func Debugln(args ...interface{})

func Errorf

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

func Errorln

func Errorln(args ...interface{})

func Infof

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

func Infoln

func Infoln(args ...interface{})

func Init

func Init(logPath, tmpLevel string, prefixs ...string)

Init Init("", "INFO")

func PutLogger

func PutLogger(_logger *Logger)

PutLogger returns `*Logger` instance back to the sync.Pool. You must call it after `GetLogger()`.

Types

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

func GetLogger

func GetLogger() *Logger

GetLogger returns `*Logger` from the sync.Pool. You must return the *Logger by calling `PutLogger()`.

func New

func New(out io.Writer) *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

func (*Logger) Debugln

func (l *Logger) Debugln(args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

func (*Logger) Flush

func (l *Logger) Flush()

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

func (*Logger) SetContext

func (l *Logger) SetContext(ctx context.Context)

func (*Logger) Sqlf

func (l *Logger) Sqlf(format string, args ...interface{})

func (*Logger) Sqlln

func (l *Logger) Sqlln(args ...interface{})

Jump to

Keyboard shortcuts

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