logger

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLogger

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

DefaultLogger default logging controller

func (*DefaultLogger) Debug

func (l *DefaultLogger) Debug() *zerolog.Event

Debug log something at debug level.

func (*DefaultLogger) Err

func (l *DefaultLogger) Err(err error) *zerolog.Event

Err log something at Err level

func (*DefaultLogger) Error

func (l *DefaultLogger) Error() *zerolog.Event

Error log something at Error level

func (*DefaultLogger) Fatal

func (l *DefaultLogger) Fatal() *zerolog.Event

Fatal log something at fatal level. This will panic!

func (*DefaultLogger) Info

func (l *DefaultLogger) Info() *zerolog.Event

Info log something at fatal level.

func (*DefaultLogger) Log

func (l *DefaultLogger) Log() *zerolog.Event

Log log something at fatal level.

func (*DefaultLogger) Print added in v1.40.0

func (l *DefaultLogger) Print(v ...interface{})

Print sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Print.

func (*DefaultLogger) Printf added in v1.40.0

func (l *DefaultLogger) Printf(format string, v ...interface{})

Printf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.

func (*DefaultLogger) RegisterSSEWriter added in v1.29.0

func (l *DefaultLogger) RegisterSSEWriter(sse *sse.Server)

func (*DefaultLogger) SetLogLevel

func (l *DefaultLogger) SetLogLevel(level string)

func (*DefaultLogger) Trace

func (l *DefaultLogger) Trace() *zerolog.Event

Trace log something at fatal level. This will panic!

func (*DefaultLogger) Warn

func (l *DefaultLogger) Warn() *zerolog.Event

Warn log something at warning level.

func (*DefaultLogger) With

func (l *DefaultLogger) With() zerolog.Context

With log with context

type Formatter added in v1.29.0

type Formatter func(interface{}) string

Formatter transforms the input into a formatted string.

type LogMessage

type LogMessage struct {
	Time    string `json:"time"`
	Level   string `json:"level"`
	Message string `json:"message"`
}

func (LogMessage) Bytes added in v1.29.0

func (m LogMessage) Bytes() ([]byte, error)

type Logger

type Logger interface {
	Log() *zerolog.Event
	Fatal() *zerolog.Event
	Err(err error) *zerolog.Event
	Error() *zerolog.Event
	Warn() *zerolog.Event
	Info() *zerolog.Event
	Trace() *zerolog.Event
	Debug() *zerolog.Event
	With() zerolog.Context
	RegisterSSEWriter(sse *sse.Server)
	SetLogLevel(level string)
	Printf(format string, v ...interface{})
	Print(v ...interface{})
}

Logger interface

func Mock

func Mock() Logger

func New

func New(cfg *domain.Config) Logger

type SSEWriter added in v1.29.0

type SSEWriter struct {
	// SSE
	SSE *sse.Server

	// TimeFormat specifies the format for timestamp in output.
	TimeFormat string

	// PartsOrder defines the order of parts in output.
	PartsOrder []string
}

func NewSSEWriter added in v1.29.0

func NewSSEWriter(sse *sse.Server, options ...func(w *SSEWriter)) SSEWriter

func (SSEWriter) Write added in v1.29.0

func (w SSEWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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