clog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const GlobalLoggerCtx = "global"

Variables

This section is empty.

Functions

func AddLoggingContext

func AddLoggingContext(ctx string, w io.WriteCloser)

func Global

func Global() *log.Entry

func RemoveLoggingContext

func RemoveLoggingContext(ctx string)

func SetGlobalLoggerLevel

func SetGlobalLoggerLevel(level log.Level) (log.Level, error)

func SetGlobalLoggerLevelFromString

func SetGlobalLoggerLevelFromString(s string) (log.Level, error)

func SetGlobalOutput

func SetGlobalOutput(w io.WriteCloser) error

func SetLevel

func SetLevel(ctx string, level log.Level) (log.Level, error)

func SetLevelFromString

func SetLevelFromString(ctx, s string) (log.Level, error)

func SetOutput

func SetOutput(ctx string, w io.WriteCloser) error

func UsingCtx

func UsingCtx(ctx string) *log.Entry

Types

type ContextLogger

type ContextLogger struct {
	GlobalLogger   *log.Logger
	ContextLoggers sync.Map
}

func NewContextLogger

func NewContextLogger(globalLoggerWriter io.WriteCloser) *ContextLogger

func (*ContextLogger) AddLoggingContext

func (l *ContextLogger) AddLoggingContext(ctx string, w io.WriteCloser)

func (*ContextLogger) Global

func (l *ContextLogger) Global() *log.Entry

func (*ContextLogger) RemoveLoggingContext

func (l *ContextLogger) RemoveLoggingContext(ctx string)

func (*ContextLogger) SetGlobalLoggerLevel

func (l *ContextLogger) SetGlobalLoggerLevel(level log.Level) (log.Level, error)

func (*ContextLogger) SetGlobalLoggerLevelFromString

func (l *ContextLogger) SetGlobalLoggerLevelFromString(s string) (log.Level, error)

func (*ContextLogger) SetGlobalOutput

func (l *ContextLogger) SetGlobalOutput(w io.WriteCloser) error

func (*ContextLogger) SetLevel

func (l *ContextLogger) SetLevel(ctx string, level log.Level) (log.Level, error)

func (*ContextLogger) SetLevelFromString

func (l *ContextLogger) SetLevelFromString(ctx, s string) (log.Level, error)

func (*ContextLogger) SetOutput

func (l *ContextLogger) SetOutput(ctx string, w io.WriteCloser) error

func (*ContextLogger) UsingCtx

func (l *ContextLogger) UsingCtx(ctx string) *log.Entry

type Handler

type Handler struct {
	Writer io.WriteCloser
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(w io.WriteCloser) *Handler

func (*Handler) CloseWriter

func (h *Handler) CloseWriter()

func (*Handler) HandleLog

func (h *Handler) HandleLog(e *log.Entry) error

func (*Handler) SetOutput

func (h *Handler) SetOutput(w io.WriteCloser)

Jump to

Keyboard shortcuts

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