ulog

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 15 Imported by: 10

Documentation

Index

Constants

View Source
const LevelDefault = LevelInfo

Variables

This section is empty.

Functions

func AppName

func AppName() string

func Close

func Close()

func Critical

func Critical(v ...any)

func Criticalf

func Criticalf(format string, v ...any)

func Debug

func Debug(v ...any)

func Debugf

func Debugf(format string, v ...any)

func Error

func Error(v ...any)

func Errorf

func Errorf(format string, v ...any)

func GenFilename

func GenFilename(dir, app string) string

func Info

func Info(v ...any)

func Infof

func Infof(format string, v ...any)

func Init

func Init(opts Options)

func InitConsole

func InitConsole()

func InitDir

func InitDir(dirname string)

func InitFile

func InitFile(filename string)

func OpenFile

func OpenFile(filename string, append bool) *os.File

func Panicf

func Panicf(format string, v ...any)

func Print

func Print(level Level, v ...any)

func Printf

func Printf(level Level, format string, v ...any)

func Query added in v0.1.45

func Query(f Filter) (lines []string, err error)

func QueryFromFile added in v0.1.45

func QueryFromFile(filename string, f Filter) (ret []string, err error)

func Recover added in v0.1.50

func Recover()

func SetHook added in v0.1.58

func SetHook(hook func(Message))

func Stat

func Stat() string

func Trace added in v0.1.45

func Trace(v ...any)

func Tracef added in v0.1.45

func Tracef(format string, v ...any)

func Warning

func Warning(v ...any)

func Warningf

func Warningf(format string, v ...any)

Types

type Filter added in v0.1.45

type Filter struct {
	Level Level
	Last  int
}

type Level

type Level int
const (
	LevelTrace Level = iota + 1
	LevelDebug
	LevelInfo
	LevelWarning
	LevelError
	LevelCritical
)

func ParseLevel

func ParseLevel(s string) Level

func (Level) Laconic

func (l Level) Laconic() string

func (Level) String

func (l Level) String() string

type Log

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

func Empty added in v0.1.52

func Empty() *Log

func New added in v0.1.3

func New(prefix string) *Log

func (*Log) Branch added in v0.1.29

func (o *Log) Branch(prefix string) *Log

func (*Log) Close

func (o *Log) Close()

func (*Log) Critical

func (o *Log) Critical(v ...any)

func (*Log) Criticalf

func (o *Log) Criticalf(format string, v ...any)

func (*Log) Debug

func (o *Log) Debug(v ...any)

func (*Log) Debugf

func (o *Log) Debugf(format string, v ...any)

func (*Log) Enable added in v0.1.26

func (o *Log) Enable(enable bool) *Log

func (*Log) Error

func (o *Log) Error(v ...any)

func (*Log) Errorf

func (o *Log) Errorf(format string, v ...any)

func (*Log) Info

func (o *Log) Info(v ...any)

func (*Log) Infof

func (o *Log) Infof(format string, v ...any)

func (*Log) Init added in v0.1.45

func (o *Log) Init(opts Options) *Log

func (*Log) IsGloabl added in v0.1.45

func (o *Log) IsGloabl() bool

func (*Log) Print

func (o *Log) Print(level Level, v ...any)

func (*Log) Printf

func (o *Log) Printf(level Level, format string, v ...any)

func (*Log) Query added in v0.1.45

func (o *Log) Query(f Filter) (lines []string, err error)

func (*Log) Recover added in v0.1.50

func (o *Log) Recover()

func (*Log) SetHook added in v0.1.73

func (o *Log) SetHook(hook func(Message))

func (*Log) Stat added in v0.1.45

func (o *Log) Stat()

func (*Log) Trace added in v0.1.47

func (o *Log) Trace(v ...any)

func (*Log) Tracef added in v0.1.47

func (o *Log) Tracef(format string, v ...any)

func (*Log) Warning

func (o *Log) Warning(v ...any)

func (*Log) Warningf

func (o *Log) Warningf(format string, v ...any)

func (*Log) WithID added in v0.1.4

func (o *Log) WithID(id any) *Log

func (*Log) WithLevel added in v0.1.26

func (o *Log) WithLevel(level Level) *Log

func (*Log) WithLifetime

func (o *Log) WithLifetime() *Log

func (*Log) WithLifetimeDebug

func (o *Log) WithLifetimeDebug() *Log

type Message

type Message struct {
	Time  time.Time
	GoID  int
	Level Level
	Text  string
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(ctx *context, level Level, v ...any) Message

func (*Message) Format

func (o *Message) Format() string

func (*Message) Size added in v0.1.45

func (o *Message) Size() int

type Options added in v0.1.49

type Options struct {
	Level     any
	Console   bool
	File      string
	Dir       string
	Append    bool
	AppName   string
	GoID      bool
	CrtStdErr bool
	SplitArgs any
	// contains filtered or unexported fields
}

type Statistics

type Statistics struct {
	Size     uint
	Trace    uint
	Debug    uint
	Info     uint
	Warning  uint
	Error    uint
	Critical uint
}

func (*Statistics) Push

func (this *Statistics) Push(level Level, size int)

Jump to

Keyboard shortcuts

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