logger

package
v0.0.0-...-f1667c9 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDebug = Level(slog.LevelDebug)
	LevelInfo  = Level(slog.LevelInfo)
	LevelWarn  = Level(slog.LevelWarn)
	LevelError = Level(slog.LevelError)
)

A set of possible logging levels

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level slog.Level

Level represents different logging levels

type Logger

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

Logger represents a logger for logging information

func New

func New(w io.Writer, serviceName string) *Logger

New constructs a new log for application use

func (*Logger) Error

func (log *Logger) Error(ctx context.Context, msg string, args ...any)

Error logs at LevelError with the given context

func (*Logger) Errorc

func (log *Logger) Errorc(ctx context.Context, caller int, msg string, args ...any)

Errorc logs the information at the specified call stack position

func (*Logger) Info

func (log *Logger) Info(ctx context.Context, msg string, args ...any)

Info logs at LevelInfo with the given context

func (*Logger) Infoc

func (log *Logger) Infoc(ctx context.Context, caller int, msg string, args ...any)

Infoc logs the information at the specified call stack position

func (*Logger) Warn

func (log *Logger) Warn(ctx context.Context, msg string, args ...any)

Warn logs at LevelWarn with the given context

func (*Logger) Warnc

func (log *Logger) Warnc(ctx context.Context, caller int, msg string, args ...any)

Warnc logs the information at the specified call stack position

Jump to

Keyboard shortcuts

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