log

package module
v0.0.0-...-abf21f3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 18 Imported by: 4 modules, 20 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

log

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAsyncWriterFull = errors.New("async writer full")

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func DelTrace

func DelTrace()

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func GenTraceId

func GenTraceId() string

func GetBuffer

func GetBuffer() *bytes.Buffer

func GetOutputWriter

func GetOutputWriter(filename string) io.Writer

func GetTrace

func GetTrace() []byte

func Info

func Info(args ...interface{})

func Infof

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

func Log

func Log(level Level, args ...interface{})

func Logf

func Logf(level Level, format string, args ...interface{})

func Panic

func Panic(args ...interface{})

func Panicf

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

func PutBuffer

func PutBuffer(buf *bytes.Buffer)

func SetTrace

func SetTrace(traceId ...string)

func SplitPackageName

func SplitPackageName(f string) (callDir string, callFunc string)

func StartMsg

func StartMsg()

func Sync

func Sync()

func Trace

func Trace(args ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

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

Types

type AsyncWriter

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

func NewAsyncWriter

func NewAsyncWriter(writer Writer) *AsyncWriter

func (*AsyncWriter) Close

func (p *AsyncWriter) Close() error

func (*AsyncWriter) Write

func (p *AsyncWriter) Write(b []byte) (n int, err error)

type Entry

type Entry struct {
	Pid     int
	Gid     int64
	TraceId []byte

	Time  time.Time
	Level Level
	File  string

	Message    string
	CallerName string
	CallerLine int
	CallerDir  string
	CallerFunc string

	PrefixMsg []byte
	SuffixMsg []byte
}

func NewEntry

func NewEntry() *Entry

func (*Entry) Reset

func (p *Entry) Reset()

type Format

type Format interface {
	Format(entry *Entry) []byte
}

type FormatFull

type FormatFull interface {
	Format
	// ParsingAndEscaping Default should be on
	ParsingAndEscaping(disable bool)

	// DisableCaller Default should be on
	Caller(disable bool)

	Clone() Format
}

type Formatter

type Formatter struct {
	Module string

	DisableParsingAndEscaping bool
	DisableCaller             bool
}

func (*Formatter) Caller

func (p *Formatter) Caller(disable bool)

func (*Formatter) Clone

func (p *Formatter) Clone() Format

func (*Formatter) Format

func (p *Formatter) Format(entry *Entry) []byte

func (*Formatter) ParsingAndEscaping

func (p *Formatter) ParsingAndEscaping(disable bool)

type Level

type Level uint32
const (
	PanicLevel Level = iota
	FatalLevel
	ErrorLevel
	WarnLevel
	InfoLevel
	DebugLevel
	TraceLevel
)

func GetLevel

func GetLevel() Level

func (Level) MarshalText

func (level Level) MarshalText() ([]byte, error)

func (Level) String

func (level Level) String() string

type Logger

type Logger struct {
	Format Format

	PrefixMsg []byte
	SuffixMsg []byte
	// contains filtered or unexported fields
}

func AddOutput

func AddOutput(writes ...io.Writer) *Logger

func Caller

func Caller(disable bool) *Logger

func Clone

func Clone() *Logger

func New

func New() *Logger

func ParsingAndEscaping

func ParsingAndEscaping(disable bool) *Logger

func SetCallerDepth

func SetCallerDepth(callerDepth int) *Logger

func SetLevel

func SetLevel(level Level) *Logger

func SetOutput

func SetOutput(writes ...io.Writer) *Logger

func SetPrefixMsg

func SetPrefixMsg(prefixMsg string) *Logger

func SetSuffixMsg

func SetSuffixMsg(suffixMsg string) *Logger

func (*Logger) AddOutput

func (p *Logger) AddOutput(writes ...io.Writer) *Logger

func (*Logger) Caller

func (p *Logger) Caller(disable bool) *Logger

func (*Logger) Clone

func (p *Logger) Clone() *Logger

func (*Logger) Debug

func (p *Logger) Debug(args ...interface{})

func (*Logger) Debugf

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

func (*Logger) Error

func (p *Logger) Error(args ...interface{})

func (*Logger) Errorf

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

func (*Logger) Fatal

func (p *Logger) Fatal(args ...interface{})

func (*Logger) Fatalf

func (p *Logger) Fatalf(format string, args ...interface{})

func (*Logger) Info

func (p *Logger) Info(args ...interface{})

func (*Logger) Infof

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

func (*Logger) Level

func (p *Logger) Level() Level

func (*Logger) Log

func (p *Logger) Log(level Level, args ...interface{})

func (*Logger) Logf

func (p *Logger) Logf(level Level, format string, args ...interface{})

func (*Logger) Panic

func (p *Logger) Panic(args ...interface{})

func (*Logger) Panicf

func (p *Logger) Panicf(format string, args ...interface{})

func (*Logger) ParsingAndEscaping

func (p *Logger) ParsingAndEscaping(disable bool) *Logger

func (*Logger) Print

func (p *Logger) Print(args ...interface{})

func (*Logger) Printf

func (p *Logger) Printf(format string, args ...interface{})

func (*Logger) SetCallerDepth

func (p *Logger) SetCallerDepth(callerDepth int) *Logger

func (*Logger) SetLevel

func (p *Logger) SetLevel(level Level) *Logger

func (*Logger) SetOutput

func (p *Logger) SetOutput(writes ...io.Writer) *Logger

func (*Logger) SetPrefixMsg

func (p *Logger) SetPrefixMsg(prefixMsg string) *Logger

func (*Logger) SetSuffixMsg

func (p *Logger) SetSuffixMsg(suffixMsg string) *Logger

func (*Logger) StartMsg

func (p *Logger) StartMsg()

func (*Logger) Sync

func (p *Logger) Sync()

func (*Logger) Trace

func (p *Logger) Trace(args ...interface{})

func (*Logger) Tracef

func (p *Logger) Tracef(format string, args ...interface{})

func (*Logger) Warn

func (p *Logger) Warn(args ...interface{})

func (*Logger) Warnf

func (p *Logger) Warnf(format string, args ...interface{})

type Writer

type Writer interface {
	io.Writer
	Close() error
}

func GetOutputWriterHourly

func GetOutputWriterHourly(filename string) Writer

Jump to

Keyboard shortcuts

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