logger

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package logger Tellstone Cloud-Native In-Memory Database File: log.go Description: Public logging contract — the Logger interface, levels, and structured fields. The internal/log package re-exports these types so internal packages and server code keep using their existing log.Level / log.Logger identifiers. Defining the contract here (a non-internal package) lets public packages like client accept and build loggers without leaking internal imports to external consumers.

Authors:

Maximilian Hagen

Package logger Tellstone Cloud-Native In-Memory Database File: logger.go Description: Adapter that bridges the logging contract to Go's structured slog logger (JSON output).

Authors:

Maximilian Hagen

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field added in v1.1.0

type Field struct {
	Key      string
	StrVal   string
	IntVal   int
	UintVal  uint64
	BoolVal  bool
	FloatVal float64
	Type     FieldType
}

Field is a structured key/value pair attached to a log message. The typed accessors below build one without boxing, keeping the hot path allocation-free.

func Bool added in v1.1.0

func Bool(key string, val bool) Field

func Float added in v1.1.0

func Float(key string, val float64) Field

func Int added in v1.1.0

func Int(key string, val int) Field

func Int64 added in v1.1.0

func Int64(key string, val int64) Field

func String added in v1.1.0

func String(key, val string) Field

func Uint added in v1.1.0

func Uint(key string, val uint32) Field

func Uint64 added in v1.1.0

func Uint64(key string, val uint64) Field

type FieldType added in v1.1.0

type FieldType uint8

FieldType discriminates the typed value carried by a Field.

const (
	TypeString FieldType = iota
	TypeInt
	TypeBool
	TypeFloat
	TypeUint
)

type Level added in v1.1.0

type Level uint8

Level identifies the severity of a log message.

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
)

func ParseLogLevel added in v1.1.0

func ParseLogLevel(lvl string) Level

ParseLogLevel maps a string level name to a Level, defaulting to Info.

func (Level) String added in v1.1.0

func (l Level) String() string

type Logger added in v1.1.0

type Logger interface {
	Enabled(level Level) bool
	Log(level Level, msg string, fields ...Field)
}

Logger is the logging surface used across the codebase. Implementations must be safe for concurrent use.

func NewNoOpLogger added in v1.1.0

func NewNoOpLogger() Logger

NewNoOpLogger returns a Logger that discards every message. It is the default for optional logging: zero allocation, zero output.

func NewSlogLogger

func NewSlogLogger(level Level) Logger

NewSlogLogger builds a Logger backed by slog's JSON handler on stdout. Logging is disabled by default in every other component; callers opt in.

type SlogAdapter

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

func (*SlogAdapter) Enabled

func (s *SlogAdapter) Enabled(level Level) bool

func (*SlogAdapter) Log

func (s *SlogAdapter) Log(level Level, msg string, fields ...Field)

Jump to

Keyboard shortcuts

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