types

package
v0.74.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package types contains the types for the log package.

Index

Constants

View Source
const (
	TraceStr    = seelog.TraceStr
	DebugStr    = seelog.DebugStr
	InfoStr     = seelog.InfoStr
	WarnStr     = seelog.WarnStr
	ErrorStr    = seelog.ErrorStr
	CriticalStr = seelog.CriticalStr
	OffStr      = seelog.OffStr
)

Log level string representations

Variables

This section is empty.

Functions

func ToSlogLevel

func ToSlogLevel(level LogLevel) slog.Level

ToSlogLevel converts a LogLevel to a slog.Level

Types

type LogLevel

type LogLevel seelog.LogLevel

LogLevel is the type of log levels

const (
	TraceLvl    LogLevel = seelog.TraceLvl
	DebugLvl    LogLevel = seelog.DebugLvl
	InfoLvl     LogLevel = seelog.InfoLvl
	WarnLvl     LogLevel = seelog.WarnLvl
	ErrorLvl    LogLevel = seelog.ErrorLvl
	CriticalLvl LogLevel = seelog.CriticalLvl
	Off         LogLevel = seelog.Off
)

Log levels

func FromSlogLevel

func FromSlogLevel(level slog.Level) LogLevel

FromSlogLevel converts a slog.Level to a LogLevel

func (LogLevel) String

func (level LogLevel) String() string

type LoggerInterface

type LoggerInterface interface {
	// Trace formats message using the default formats for its operands
	// and writes to log with level = Trace
	Trace(v ...interface{})

	// Debug formats message using the default formats for its operands
	// and writes to log with level = Debug
	Debug(v ...interface{})

	// Info formats message using the default formats for its operands
	// and writes to log with level = Info
	Info(v ...interface{})

	// Warn formats message using the default formats for its operands
	// and writes to log with level = Warn
	Warn(v ...interface{}) error

	// Error formats message using the default formats for its operands
	// and writes to log with level = Error
	Error(v ...interface{}) error

	// Critical formats message using the default formats for its operands
	// and writes to log with level = Critical
	Critical(v ...interface{}) error

	// Close flushes all the messages in the logger and closes it. It cannot be used after this operation.
	Close()

	// Flush flushes all the messages in the logger.
	Flush()

	// SetAdditionalStackDepth sets the additional number of frames to skip by runtime.Caller
	SetAdditionalStackDepth(depth int) error

	// Sets logger context that can be used in formatter funcs and custom receivers
	SetContext(context interface{})

	// Tracef formats message according to format specifier
	// and writes to log with level = Trace.
	Tracef(format string, params ...interface{})

	// Debugf formats message according to format specifier
	// and writes to log with level = Debug.
	Debugf(format string, params ...interface{})

	// Infof formats message according to format specifier
	// and writes to log with level = Info.
	Infof(format string, params ...interface{})

	// Warnf formats message according to format specifier
	// and writes to log with level = Warn.
	Warnf(format string, params ...interface{}) error

	// Errorf formats message according to format specifier
	// and writes to log with level = Error.
	Errorf(format string, params ...interface{}) error

	// Criticalf formats message according to format specifier
	// and writes to log with level = Critical.
	Criticalf(format string, params ...interface{}) error
}

LoggerInterface provides basic logging methods that can be used from outside the log package.

Jump to

Keyboard shortcuts

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