log

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

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

Go to latest
Published: Mar 23, 2023 License: MPL-2.0 Imports: 14 Imported by: 10 modules, 72 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

logging in go

Installation

go get -u github.com/darabuchi/log

Quick Start

log.Info("msg")
log.Infof("msg:%s", "this is msg")

image

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 GetOutputWriterHourly

func GetOutputWriterHourly(filename string, max uint) io.Writer

func GetTrace

func GetTrace() string

func Info

func Info(args ...interface{})

func Infof

func Infof(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) (string, 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 Entry

type Entry struct {
	Pid     int
	Gid     int64
	TraceId string

	Time  time.Time
	Level Level
	File  string

	Message    string
	CallerName string
	CallerLine int
	CallerDir  string
	CallerFunc string

	PrefixMsg string
	SuffixMsg string
}

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 (Level) MarshalText

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

func (Level) String

func (level Level) String() string

type Logger

type Logger struct {
	Format Format

	PrefixMsg string
	SuffixMsg string
	// 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) 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{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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