zlog

package
v0.0.0-...-e18dc9b Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(message ...any)

Debug logs a debug message.

func Debugf

func Debugf(template string, message ...any)

Debugf logs a debug message.

func Error

func Error(message ...any)

Error logs an error message.

func Errorf

func Errorf(template string, message ...any)

Errorf logs an error message with a format.

func Fatal

func Fatal(message ...any)

Fatal logs a fatal message.

func Fatalf

func Fatalf(template string, message ...any)

Fatalf logs a fatal message.

func Info

func Info(message ...any)

Info logs an info message.

func Infof

func Infof(template string, message ...any)

Infof logs an info message with a format.

func SetLogLevel

func SetLogLevel(ll Level)

SetLogLevel set logger default level

func SetScopeLogLevel

func SetScopeLogLevel(scope string, ll Level)

func Warn

func Warn(message ...any)

Warn logs an warn message.

func Warnf

func Warnf(template string, message ...any)

Warnf logs an error message with a format.

Types

type Level

type Level int

Level is log level of logger

const (
	// LevelDebug is the lowest level of verbosity.
	LevelDebug Level = 0

	// LevelInfo is the default level of verbosity.
	LevelInfo Level = 1

	// LevelWarning is the default level of verbosity.
	LevelWarning Level = 2

	// LevelError is the default level of verbosity.
	LevelError Level = 3

	// LevelFatal is the highest level of verbosity.
	LevelFatal Level = 4
)

func ToLevel

func ToLevel(logLevel string) Level

func (Level) Int

func (l Level) Int() int

Int return integer type

func (Level) String

func (l Level) String() string

String return String type

type Logger

type Logger interface {
	Info(msg string, event proto.Message)
	Debug(msg string, event proto.Message)
	Warn(msg string, event proto.Message)
	Error(msg string, event proto.Message)
	V(l int) bool
	Sync() error
}

func NewJSONLogger

func NewJSONLogger(named string, logKind typepb.LogKind, level Level) Logger

type Sugar

type Sugar interface {
	Info(args ...any)
	Infof(template string, args ...any)
	Infoln(args ...any)

	Debug(args ...any)
	Debugf(template string, args ...any)
	Debugln(args ...any)

	Warning(args ...any)
	Warningf(template string, args ...any)
	Warningln(args ...any)

	Error(args ...any)
	Errorf(template string, args ...any)
	Errorln(args ...any)

	Fatal(args ...any)
	Fatalf(template string, args ...any)
	Fatalln(args ...any)

	V(l int) bool
	Sync() error
}

Sugar define default logger for logger

func NewConsole

func NewConsole(scope string, level Level) Sugar

func NewDefaultConsole

func NewDefaultConsole(level Level) Sugar

Jump to

Keyboard shortcuts

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