logger

package
v0.0.0-...-75e6539 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logger provides a convenience function to constructing a logger for use. This is required not just for applications but for testing.

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

func New

func New(service string, outputPaths ...string) (*zap.SugaredLogger, error)

New constructs a Sugared Logger that writes to stdout and provides human-readable timestamps.

Types

type EventFunc

type EventFunc func(ctx context.Context, r Record)

EventFunc is a function to be executed when configured against a log level.

type Events

type Events struct {
	Debug EventFunc
	Info  EventFunc
	Warn  EventFunc
	Error EventFunc
}

Events contains an assignment of an event function to a log level.

type Level

type Level slog.Level

Level represents different logging levels.

type Record

type Record struct {
	Time       time.Time
	Message    string
	Level      Level
	Attributes map[string]any
}

Record represents the data that is being logged.

Jump to

Keyboard shortcuts

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