Documentation ¶
Overview ¶
Package logging provides a logging implementation for use with vise.
Index ¶
- Constants
- Variables
- func AsString(level int) string
- type Logger
- type Vanilla
- func (v Vanilla) DebugCtxf(ctx context.Context, msg string, args ...any)
- func (v Vanilla) Debugf(msg string, args ...any)
- func (v Vanilla) ErrorCtxf(ctx context.Context, msg string, args ...any)
- func (v Vanilla) Errorf(msg string, args ...any)
- func (v Vanilla) InfoCtxf(ctx context.Context, msg string, args ...any)
- func (v Vanilla) Infof(msg string, args ...any)
- func (v Vanilla) PrintCtxf(ctx context.Context, level int, msg string, args ...any)
- func (v Vanilla) Printf(level int, msg string, args ...any)
- func (v Vanilla) TraceCtxf(ctx context.Context, msg string, args ...any)
- func (v Vanilla) Tracef(msg string, args ...any)
- func (v Vanilla) WarnCtxf(ctx context.Context, msg string, args ...any)
- func (v Vanilla) Warnf(msg string, args ...any)
- func (v Vanilla) WithDomain(domain string) Vanilla
- func (v Vanilla) WithLevel(level int) Vanilla
- func (v Vanilla) WriteCtxf(ctx context.Context, w io.Writer, level int, msg string, args ...any)
- func (v Vanilla) Writef(w io.Writer, level int, msg string, args ...any)
Constants ¶
const ( // No logging LVL_NONE = iota // Error log level - unexpected states that need immediate developer attention. LVL_ERROR // Warning log level - unexpected states that may need developer attention. LVL_WARN // Info log level - expected states that are of general interest to the end-user. LVL_INFO // Debug log level - expected states that are of general interest to the developer. LVL_DEBUG // Trace log level - everything else. LVL_TRACE )
Variables ¶
var (
LogLevel = LVL_NONE
)
Functions ¶
Types ¶
type Logger ¶
type Logger interface { // Writef logs a line to the given writer with the given loglevel. Writef(w io.Writer, level int, msg string, args ...any) // WriteCtxf logs a line with context to the given writer with the given loglevel. WriteCtxf(ctx context.Context, w io.Writer, level int, msg string, args ...any) // Printf logs a line to the default writer with the given loglevel. Printf(level int, msg string, args ...any) // Printf logs a line with context to the default writer with the given loglevel. PrintCtxf(ctx context.Context, level int, msg string, args ...any) // Tracef logs a line to the default writer the TRACE loglevel. Tracef(msg string, args ...any) // TraceCtxf logs a line with context to the default writer the TRACE loglevel. TraceCtxf(ctx context.Context, msg string, args ...any) // Debugf logs a line to the default writer the DEBUG loglevel. Debugf(msg string, args ...any) // DebugCtxf logs a line with context to the default writer the DEBUG loglevel. DebugCtxf(ctx context.Context, msg string, args ...any) // Infof logs a line to the default writer the INFO loglevel. Infof(msg string, args ...any) // InfoCtxf logs a line with context to the default writer the INFO loglevel. InfoCtxf(ctx context.Context, msg string, args ...any) // Warnf logs a line to the default writer the WARN loglevel. Warnf(msg string, args ...any) // WarnCtxf logs a line with context to the default writer the WARN loglevel. WarnCtxf(ctx context.Context, msg string, args ...any) // Errorf logs a line to the default writer the ERROR loglevel. Errorf(msg string, args ...any) // ErrorCtxf logs a line with context to the default writer the ERROR loglevel. ErrorCtxf(ctx context.Context, msg string, args ...any) }
type Vanilla ¶
type Vanilla struct {
// contains filtered or unexported fields
}
Vanilla is a basic single-line structured output logger for terminal output.
func (Vanilla) DebugCtxf ¶
DebugCtxf logs a line with context with level DEBUG to the global writer.
func (Vanilla) Debugf ¶
Debugf logs a line with level DEBUG to the global writer.
func (Vanilla) ErrorCtxf ¶
ErrorCtxf logs a line with context with level ERROR to the global writer.
func (Vanilla) Errorf ¶
Errorf logs a line with level ERROR to the global writer.
func (Vanilla) InfoCtxf ¶
InfoCtxf logs a line with context with level INFO to the global writer.
func (Vanilla) Infof ¶
Infof logs a line with level INFO to the global writer.
func (Vanilla) PrintCtxf ¶
PrintCtxf logs with context to the global writer.
func (Vanilla) Printf ¶
Printf logs to the global writer.
func (Vanilla) TraceCtxf ¶
TraceCtxf logs a line with context with level TRACE to the global writer.
func (Vanilla) Tracef ¶
Tracef logs a line with level TRACE to the global writer.
func (Vanilla) WarnCtxf ¶
WarnCtxf logs a line with context with level WARN to the global writer.
func (Vanilla) Warnf ¶
Warnf logs a line with level WARN to the global writer.
func (Vanilla) WithDomain ¶
WithDomain sets the logging domain. It is prepended to the caller file/line information.
func (Vanilla) WithLevel ¶
WithLevel overrides the globally set loglevel for the logger instance.
func (Vanilla) WriteCtxf ¶
WriteCtxf logs with context to the given writer.