slog

package module
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 1 Imported by: 3

README

slog

Build Status

Унниверсальная библиотека-обертка над различными logger-ами

Documentation

Index

Constants

View Source
const (
	FatalLevel int = iota
	PanicLevel
	ErrorLevel
	WarningLevel
	InfoLevel
	DebugLevel
)

Уровни логирования

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, log Logger) context.Context

ToContext помещает логгер в контекст

Types

type Logger

type Logger interface {
	Error(args ...any)
	Errorf(template string, args ...any)

	Fatal(args ...any)
	Fatalf(template string, args ...any)

	Info(args ...any)
	Infof(template string, args ...any)

	Panic(args ...any)
	Panicf(template string, args ...any)

	Warn(args ...any)
	Warnf(template string, args ...any)

	Debug(args ...any)
	Debugf(template string, args ...any)

	With(args ...any) Logger

	Sync()
}

Logger - интерфейс логгера

func MustFromContext

func MustFromContext(ctx context.Context) Logger

MustFromContext возвращает логгер из контекста, в случае отсутствия логгера в контексте - паника

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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