debug

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJSON = "json"
	FormatYAML = "yaml"
)

Variables

This section is empty.

Functions

func Initialize added in v0.13.2

func Initialize()

Initialize global logger

func Log

func Log(data interface{}) error

Log global logging function

func Teardown

func Teardown()

Teardown global logger

func Trace

func Trace(funcName string, args ...interface{}) string

Trace global trace function

func Untrace added in v0.13.2

func Untrace(funcName string)

Untrace global untrace function

Types

type Formatter added in v0.13.2

type Formatter interface {
	Format(interface{}) ([]byte, error)
	FileExtension() string
}

Formatter defines the log formatter interface

type JSONFormatter added in v0.13.2

type JSONFormatter struct{}

JSONFormatter implements JSON format

func (JSONFormatter) FileExtension added in v0.13.2

func (f JSONFormatter) FileExtension() string

func (JSONFormatter) Format added in v0.13.2

func (f JSONFormatter) Format(data interface{}) ([]byte, error)

type Logger added in v0.13.2

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

Logger core logging structure

func NewLogger added in v0.13.2

func NewLogger(options ...Option) (*Logger, error)

NewLogger creates a new Logger instance

func (*Logger) Close added in v0.13.2

func (l *Logger) Close() error

Close closes the log file and cleans up resources

func (*Logger) Log added in v0.13.2

func (l *Logger) Log(data interface{}) error

Log writes structured log

func (*Logger) Trace added in v0.13.2

func (l *Logger) Trace(funcName string, args ...interface{}) string

Trace logs function entry

func (*Logger) Untrace added in v0.13.2

func (l *Logger) Untrace(funcName string)

Untrace logs function exit

type Option added in v0.13.2

type Option func(*Logger) error

Option configuration function type

func WithBufferSize added in v0.13.2

func WithBufferSize(size int) Option

WithBufferSize sets buffer size

func WithFormatter added in v0.13.2

func WithFormatter(f Formatter) Option

WithFormatter sets log format

type YAMLFormatter added in v0.13.2

type YAMLFormatter struct{}

YAMLFormatter implements YAML format

func (YAMLFormatter) FileExtension added in v0.13.2

func (f YAMLFormatter) FileExtension() string

func (YAMLFormatter) Format added in v0.13.2

func (f YAMLFormatter) Format(data interface{}) ([]byte, error)

Jump to

Keyboard shortcuts

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