slogstringlevel

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 4 Imported by: 0

README

slogstringlevel

Go Reference GitHub go.mod Go version Go Report Card

Documentation

Overview

Package slogstringlevel provides a string that implements slog.Leveler. Useful for unmarshalling from a string value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SlogStringLevel

type SlogStringLevel string

SlogStringLevel is a string that implements slog.Leveler.

const (
	LevelDebug SlogStringLevel = "debug"
	LevelInfo  SlogStringLevel = "info"
	LevelWarn  SlogStringLevel = "warn"
	LevelError SlogStringLevel = "error"
)

func (SlogStringLevel) Level

func (l SlogStringLevel) Level() slog.Level

Level returns the slog.Level corresponding to the SlogStringLevel.

func (*SlogStringLevel) UnmarshalText added in v1.1.0

func (l *SlogStringLevel) UnmarshalText(text []byte) error

UnmarshalText unmarshals a string into a SlogStringLevel. It first trims the string and converts it to lowercase and then tries to match it to a valid SlogStringLevel. Returns an error if the string is not a valid SlogStringLevel.

Jump to

Keyboard shortcuts

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