slog

package
v0.8.13 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package slog is a structured logging library which is for use by shellrepeater or any other servers, it should not be used by commands that are run directly by users (e.g. the earthly binary)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func With

func With(ctx context.Context, key string, value interface{}) context.Context

With adds logging metadata to the logger within the context.

func WithLogger

func WithLogger(ctx context.Context, l Logger) context.Context

WithLogger returns a new context with a logger added to it.

Types

type Logger

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

Logger represents a logger with some structured metadata associated.

func GetLogger

func GetLogger(ctx context.Context) Logger

GetLogger returns a logger associated with this context.

func (Logger) Debug

func (l Logger) Debug(msg string)

Debug logs debug message.

func (Logger) Error

func (l Logger) Error(err error)

Error logs error message.

func (Logger) Fatal

func (l Logger) Fatal(msg string)

Fatal logs fatal message and calls os.Exit(1).

func (Logger) Info

func (l Logger) Info(msg string)

Info logs info message.

func (Logger) Panic

func (l Logger) Panic(msg string)

Panic logs panic message and calls panic.

func (Logger) Warning

func (l Logger) Warning(msg string)

Warning logs warning message.

func (Logger) With

func (l Logger) With(key string, value interface{}) Logger

With adds metadata to the logger.

Jump to

Keyboard shortcuts

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