logger

package
v0.0.0-...-ef5cc6b Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 17 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ANSI_CODE_RESET string = "\x1b[0m"

	ANSI_CODE_BOLD            string = "\x1b[1m"
	ANSI_CODE_BOLD_RESET      string = "\x1b[22m"
	ANSI_CODE_DIM             string = "\x1b[2m"
	ANSI_CODE_DIM_RESET       string = "\x1b[22m"
	ANSI_CODE_ITALIC          string = "\x1b[3m"
	ANSI_CODE_ITALIC_RESET    string = "\x1b[23m"
	ANSI_CODE_UNDERLINE       string = "\x1b[4m"
	ANSI_CODE_UNDERLINE_RESET string = "\x1b[24m"
	ANSI_CODE_BLINK           string = "\x1b[5m"
	ANSI_CODE_BLINK_RESET     string = "\x1b[25m"
	ANSI_CODE_REVERSE         string = "\x1b[7m"
	ANSI_CODE_REVERSE_RESET   string = "\x1b[27m"
	ANSI_CODE_HIDE            string = "\x1b[8m"
	ANSI_CODE_HIDE_RESET      string = "\x1b[28m"
	ANSI_CODE_STRIKE          string = "\x1b[9m"
	ANSI_CODE_STRIKE_RESET    string = "\x1b[29m"

	ANSI_CODE_FOREGROUND_RESET   string = "\x1b[0m"
	ANSI_CODE_BACKGROUND_RESET   string = "\x1b[0m"
	ANSI_CODE_FOREGROUND_BLACK   string = "\x1b[30m"
	ANSI_CODE_BACKGROUND_BLACK   string = "\x1b[40m"
	ANSI_CODE_FOREGROUND_RED     string = "\x1b[31m"
	ANSI_CODE_BACKGROUND_RED     string = "\x1b[41m"
	ANSI_CODE_FOREGROUND_GREEN   string = "\x1b[32m"
	ANSI_CODE_BACKGROUND_GREEN   string = "\x1b[42m"
	ANSI_CODE_FOREGROUND_YELLOW  string = "\x1b[33m"
	ANSI_CODE_BACKGROUND_YELLOW  string = "\x1b[43m"
	ANSI_CODE_FOREGROUND_BLUE    string = "\x1b[34m"
	ANSI_CODE_BACKGROUND_BLUE    string = "\x1b[44m"
	ANSI_CODE_FOREGROUND_MAGENTA string = "\x1b[35m"
	ANSI_CODE_BACKGROUND_MAGENTA string = "\x1b[45m"
	ANSI_CODE_FOREGROUND_CYAN    string = "\x1b[36m"
	ANSI_CODE_BACKGROUND_CYAN    string = "\x1b[46m"
	ANSI_CODE_FOREGROUND_WHITE   string = "\x1b[37m"
	ANSI_CODE_BACKGROUND_WHITE   string = "\x1b[47m"
	ANSI_CODE_FOREGROUND_GRAY    string = "\x1b[90m"
	ANSI_CODE_FOREGROUND_DEFAULT string = "\x1b[39m"
	ANSI_CODE_BACKGROUND_DEFAULT string = "\x1b[49m"

	ANSI_CODE_ERASE_SCREEN_END   string = "\x1b[0Jm"
	ANSI_CODE_ERASE_SCREEN_START string = "\x1b[1Jm"
	ANSI_CODE_ERASE_SCREEN       string = "\x1b[2Jm"
	ANSI_CODE_ERASE_LINE_END     string = "\x1b[0K"
	ANSI_CODE_ERASE_LINE_START   string = "\x1b[1K"
	ANSI_CODE_ERASE_LINE         string = "\x1b[2K"
)

Variables

This section is empty.

Functions

func Match

func Match(input string, pattern string) bool

func New

func New(name string) *slog.Logger

func Request

func Request(log *slog.Logger) func(http.Handler) http.Handler

Types

type ColorTextHandler

type ColorTextHandler struct {
	// contains filtered or unexported fields
}

func NewColorTextHandler

func NewColorTextHandler(opts *slog.HandlerOptions) *ColorTextHandler

func (*ColorTextHandler) Enabled

func (self *ColorTextHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*ColorTextHandler) Handle

func (self *ColorTextHandler) Handle(ctx context.Context, r slog.Record) error

func (*ColorTextHandler) WithAttrs

func (self *ColorTextHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*ColorTextHandler) WithGroup

func (self *ColorTextHandler) WithGroup(name string) slog.Handler

type Level

type Level string
const (
	Debug Level = "debug"
	Info  Level = "info"
	Warn  Level = "warn"
	Error Level = "error"
)

func (Level) SLog

func (self Level) SLog() slog.Level

func (Level) Valid

func (self Level) Valid() bool

type Text

type Text string

func (Text) BlackBackground

func (self Text) BlackBackground() Text

func (Text) BlackForeground

func (self Text) BlackForeground() Text
func (self Text) Blink() Text

func (Text) BlueBackground

func (self Text) BlueBackground() Text

func (Text) BlueForeground

func (self Text) BlueForeground() Text

func (Text) Bold

func (self Text) Bold() Text

func (Text) CyanBackground

func (self Text) CyanBackground() Text

func (Text) CyanForeground

func (self Text) CyanForeground() Text

func (Text) DefaultBackground

func (self Text) DefaultBackground() Text

func (Text) DefaultForeground

func (self Text) DefaultForeground() Text

func (Text) Dim

func (self Text) Dim() Text

func (Text) EraseLine

func (self Text) EraseLine() Text

func (Text) EraseLineEnd

func (self Text) EraseLineEnd() Text

func (Text) EraseLineStart

func (self Text) EraseLineStart() Text

func (Text) EraseScreen

func (self Text) EraseScreen() Text

func (Text) EraseScreenEnd

func (self Text) EraseScreenEnd() Text

func (Text) EraseScreenStart

func (self Text) EraseScreenStart() Text

func (Text) GrayForeground

func (self Text) GrayForeground() Text

func (Text) GreenBackground

func (self Text) GreenBackground() Text

func (Text) GreenForeground

func (self Text) GreenForeground() Text

func (Text) Hide

func (self Text) Hide() Text

func (Text) Italic

func (self Text) Italic() Text

func (Text) MagentaBackground

func (self Text) MagentaBackground() Text

func (Text) MagentaForeground

func (self Text) MagentaForeground() Text

func (Text) PadLeft

func (self Text) PadLeft(n int) Text

func (Text) PadRight

func (self Text) PadRight(n int) Text

func (Text) RedBackground

func (self Text) RedBackground() Text

func (Text) RedForeground

func (self Text) RedForeground() Text

func (Text) Reverse

func (self Text) Reverse() Text

func (Text) Strike

func (self Text) Strike() Text

func (Text) String

func (self Text) String() string

func (Text) Underline

func (self Text) Underline() Text

func (Text) WhiteBackground

func (self Text) WhiteBackground() Text

func (Text) WhiteForeground

func (self Text) WhiteForeground() Text

func (Text) YellowBackground

func (self Text) YellowBackground() Text

func (Text) YellowForeground

func (self Text) YellowForeground() Text

Jump to

Keyboard shortcuts

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