log

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 15 Imported by: 2

README

flam-log

Go-linter Go-test

flam-log is a flam-in-go extension to provide logging functionalities

Documentation

Index

Constants

View Source
const (
	SerializerCreatorGroup   = "flam.log.serializers.creator"
	SerializerDriverString   = "flam.log.serializers.driver.string"
	SerializerDriverJson     = "flam.log.serializers.driver.json"
	StreamCreatorGroup       = "flam.log.streams.creator"
	StreamDriverConsole      = "flam.log.streams.driver.console"
	StreamDriverFile         = "flam.log.streams.driver.file"
	StreamDriverRotatingFile = "flam.log.streams.driver.rotating-file"

	PathDefaultLevel      = "flam.log.defaults.level"
	PathDefaultSerializer = "flam.log.defaults.serializer"
	PathDefaultDisk       = "flam.log.defaults.disk"
	PathBoot              = "flam.log.boot"
	PathFlusherFrequency  = "flam.log.flusher.frequency"
	PathSerializers       = "flam.log.serializers"
	PathStreams           = "flam.log.streams"
)

Variables

View Source
var (
	DefaultLevel      = Info
	DefaultSerializer = ""
	DefaultDisk       = ""
)
View Source
var (
	ErrStreamNotFound  = errors.New("log stream not found")
	ErrDuplicateStream = errors.New("duplicate log stream")
)
View Source
var LevelMap = map[string]Level{
	"none":    None,
	"fatal":   Fatal,
	"error":   Error,
	"warning": Warning,
	"notice":  Notice,
	"info":    Info,
	"debug":   Debug,
}
View Source
var LevelName = map[Level]string{
	None:    "none",
	Fatal:   "fatal",
	Error:   "error",
	Warning: "warning",
	Notice:  "notice",
	Info:    "info",
	Debug:   "debug",
}

Functions

func NewProvider

func NewProvider() flam.Provider

Types

type Facade

type Facade interface {
	Signal(level Level, channel, message string, ctx ...flam.Bag) error
	Broadcast(level Level, message string, ctx ...flam.Bag) error
	FatalSignal(channel, message string, ctx ...flam.Bag) error
	FatalBroadcast(message string, ctx ...flam.Bag) error
	ErrorSignal(channel, message string, ctx ...flam.Bag) error
	ErrorBroadcast(message string, ctx ...flam.Bag) error
	WarningSignal(channel, message string, ctx ...flam.Bag) error
	WarningBroadcast(message string, ctx ...flam.Bag) error
	NoticeSignal(channel, message string, ctx ...flam.Bag) error
	NoticeBroadcast(message string, ctx ...flam.Bag) error
	InfoSignal(channel, message string, ctx ...flam.Bag) error
	InfoBroadcast(message string, ctx ...flam.Bag) error
	DebugSignal(channel, message string, ctx ...flam.Bag) error
	DebugBroadcast(message string, ctx ...flam.Bag) error
	Flush() error

	HasSerializer(id string) bool
	ListSerializers() []string
	GetSerializer(id string) (Serializer, error)
	AddSerializer(id string, serializer Serializer) error

	HasStream(id string) bool
	ListStreams() []string
	GetStream(id string) (Stream, error)
	AddStream(id string, stream Stream) error
	RemoveStream(id string) error
	RemoveAllStreams() error
}

type Level

type Level int
const (
	None Level = iota
	Fatal
	Error
	Warning
	Notice
	Info
	Debug
)

func LevelFrom

func LevelFrom(
	val any,
	def ...Level,
) Level

type Serializer

type Serializer interface {
	Close() error

	Serialize(timestamp time.Time, level Level, message string, ctx flam.Bag) string
}

type SerializerCreator

type SerializerCreator interface {
	Accept(config flam.Bag) bool
	Create(config flam.Bag) (Serializer, error)
}

type Stream

type Stream interface {
	Close() error

	GetLevel() Level
	SetLevel(level Level) error

	HasChannel(channel string) bool
	ListChannels() []string
	AddChannel(channel string) error
	RemoveChannel(channel string) error
	RemoveAllChannels() error

	Signal(timestamp time.Time, level Level, channel, message string, ctx flam.Bag) error
	Broadcast(timestamp time.Time, level Level, message string, ctx flam.Bag) error
}

type StreamCreator

type StreamCreator interface {
	Accept(config flam.Bag) bool
	Create(config flam.Bag) (Stream, error)
}

Jump to

Keyboard shortcuts

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