log

package module
v0.0.0-...-0a519a5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: AGPL-3.0 Imports: 15 Imported by: 13

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) io.Writer

func GetTrace

func GetTrace() []byte

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 []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 (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) 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