ulog

package
v0.7.76 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 19 Imported by: 11

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(ts time.Time, 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 StdBridge added in v0.1.78

func StdBridge(onMessage func(string)) *log.Logger

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 Global added in v0.3.32

func Global() *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) Enabled added in v0.2.2

func (o *Log) Enabled() bool

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) IsEmpty added in v0.7.13

func (o *Log) IsEmpty() bool

func (*Log) IsGloabl added in v0.1.45

func (o *Log) IsGloabl() bool

func (*Log) Options added in v0.3.32

func (o *Log) Options() Options

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) Timezone added in v0.2.87

func (o *Log) Timezone() (string, int)

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
	Timezone        string
	CrtStdErr       bool
	SplitArgs       any
	FileSizeLimit   uint64
	FileTimeLimit   time.Duration
	DaysCountLimit  int
	TotalSizeLimit  uint64
	LockInitialFile bool
	Async           bool
	// contains filtered or unexported fields
}

type Queue added in v0.7.55

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue added in v0.7.55

func NewQueue[T any]() *Queue[T]

func (*Queue[T]) Capacity added in v0.7.55

func (o *Queue[T]) Capacity() int

func (*Queue[T]) Pop added in v0.7.55

func (o *Queue[T]) Pop() (v T, ok bool)

func (*Queue[T]) Push added in v0.7.55

func (o *Queue[T]) Push(v T) bool

func (*Queue[T]) Reset added in v0.7.55

func (o *Queue[T]) Reset()

func (*Queue[T]) SetCapacity added in v0.7.55

func (o *Queue[T]) SetCapacity(capacity int)

func (*Queue[T]) Size added in v0.7.55

func (o *Queue[T]) Size() int

type Statistics

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

func (*Statistics) Push

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

type StdWriter added in v0.1.78

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

func NewStdWriter added in v0.1.78

func NewStdWriter(onMessage func(string)) *StdWriter

func (*StdWriter) Write added in v0.1.78

func (o *StdWriter) Write(bytes []byte) (n int, err error)

Jump to

Keyboard shortcuts

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