logging

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWatermillAdapter

func NewWatermillAdapter(log ServiceLogger) watermill.LoggerAdapter

NewWatermillAdapter converts a ServiceLogger into a Watermill LoggerAdapter so internal runtime components can reuse the same logger abstraction.

Types

type EntryLogger

type EntryLogger interface {
	EntryLoggerAdapter[EntryLogger]
}

EntryLogger represents the legacy non-generic entry adapter constraint. It remains exported so existing code that referenced protoflow.EntryLogger keeps compiling, but NewEntryServiceLogger now works with any logger that satisfies EntryLoggerAdapter[T].

type EntryLoggerAdapter

type EntryLoggerAdapter[T any] interface {
	Error(args ...any)
	Info(args ...any)
	Debug(args ...any)
	Trace(args ...any)
	WithError(err error) T
	WithField(key string, value any) T
}

EntryLoggerAdapter captures the capabilities required by NewEntryServiceLogger. The constraint is generic so third-party entry-like loggers (for example, loggers whose methods return their own concrete interface type) can be used without additional wrappers.

type LogFields

type LogFields map[string]any

LogFields represents structured logging key/value pairs used by Protoflow.

type ServiceLogger

type ServiceLogger interface {
	With(fields LogFields) ServiceLogger
	Debug(msg string, fields LogFields)
	Info(msg string, fields LogFields)
	Error(msg string, err error, fields LogFields)
	Trace(msg string, fields LogFields)
}

ServiceLogger is the minimal logging contract required by Protoflow services. It maps directly onto Watermill's logging needs so applications can adapt their existing loggers without depending on slog.

func NewEntryServiceLogger

func NewEntryServiceLogger[T EntryLoggerAdapter[T]](entry T) ServiceLogger

NewEntryServiceLogger wraps an EntryLogger (for example a logrus.Entry) so it can be consumed by Protoflow services without forcing additional logging adapters.

func NewSlogServiceLogger

func NewSlogServiceLogger(log *slog.Logger) ServiceLogger

NewSlogServiceLogger wraps a slog.Logger so it satisfies the ServiceLogger interface. This matches the previous behaviour of Protoflow services.

func NewWatermillServiceLogger

func NewWatermillServiceLogger(logger watermill.LoggerAdapter) ServiceLogger

NewWatermillServiceLogger wraps an existing Watermill LoggerAdapter so it can be supplied to NewService.

Jump to

Keyboard shortcuts

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