slogext

package
v0.7.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package slogext is a small wrapper around the log/slog package focused on providing consistency in logging across the stencil codebase.

Index

Constants

View Source
const (
	DebugLevel = charmlog.DebugLevel
	InfoLevel  = charmlog.InfoLevel
	WarnLevel  = charmlog.WarnLevel
	ErrorLevel = charmlog.ErrorLevel
	FatalLevel = charmlog.FatalLevel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level = charmlog.Level

Level is a logging level.

type Logger

type Logger interface {
	Info(string, ...any)
	Infof(string, ...any)
	Debug(string, ...any)
	Debugf(string, ...any)
	Error(string, ...any)
	Errorf(string, ...any)
	Warn(string, ...any)
	Warnf(string, ...any)
	With(...any) Logger
	WithError(error) Logger
	SetLevel(charmlog.Level)
}

func New

func New() Logger

New creates a new logger using the slog package.

func NewTestLogger

func NewTestLogger(t *testing.T) Logger

NewTestLogger creates a new logger for testing purposes. The logging level is set to DebugLevel to ensure all logs are captured.

Jump to

Keyboard shortcuts

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