Categorygithub.com/synfinatic/flexlog
modulepackage
0.0.5
Repository: https://github.com/synfinatic/flexlog.git
Documentation: pkg.go.dev

# README

flexlog

The Flexible slog.Handler

About

I wanted to switch from logrus to slog in aws-sso-cli, but I found the default slog library a bit too basic for my tastes. Additionally, one feature I really <3 about logrus was the ability to write unit tests against generated logs; a feature which is currently missing from slog.

Anyways, I decided to breakout my work into a separate library for future use. Maybe it'll work for you too?

# Packages

No description provided by the author

# Functions

NewConsole creates a new slog.Handler for the ConsoleHandler, which wraps tint.NewHandler with some customizations.
ConsoleHandler is a slog.Handler that wraps tint.Handler.
No description provided by the author
No description provided by the author
NewLoggerFunc creates a new Logger.
No description provided by the author

# Constants

No description provided by the author
Define our custom levels.
Define our custom levels.
number of stack frames to skip in Handler.Handle.

# Variables

LevelColorsMap is a map of log levels to their colors and the name of the level.
LevelNames defines additional log levels.
LevelStrings is a map of level names to their slog.Level values.

# Structs

implement the slog.Handler interface via the tint.Handler.
No description provided by the author
LevelColors defines the name as displayed to the user and color of a log level.
LevelColors is our internal representation of the user-defined LevelColorsMapping.
Our logger which wraps slog.Logger and implements CustomLogger.

# Interfaces

No description provided by the author

# Type aliases

LevelColorsMapping is a map of log levels to their colors and is what the user defines in their configuration.
No description provided by the author