logentry

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logentry defines the log entry model used for centralized log collection.

Index

Constants

View Source
const NATSSubjectPrefix = "sys.log"

NATSSubjectPrefix is the base subject for log publishing. Full subject: sys.log.{service}

View Source
const NATSSubjectWildcard = "sys.log.>"

NATSSubjectWildcard matches all service log subjects.

Variables

This section is empty.

Functions

func NATSSubject

func NATSSubject(service string) string

NATSSubject returns the NATS subject for a given service name.

Types

type LogEntry

type LogEntry struct {
	ID        string                 `json:"id"`        // ULID for time-ordered keys
	Timestamp int64                  `json:"timestamp"` // Unix millis
	Service   string                 `json:"service"`   // e.g. "admin_server", "queue_server"
	Level     string                 `json:"level"`     // "debug","info","warn","error","fatal"
	Message   string                 `json:"message"`
	Component string                 `json:"component"`          // sub-component within service
	Hostname  string                 `json:"hostname,omitempty"` // OS hostname of the publishing node
	Fields    map[string]interface{} `json:"fields,omitempty"`   // structured fields from the log call site
}

LogEntry represents a single log message published by a service.

func NewLogEntry

func NewLogEntry(service, level, message, component string) *LogEntry

NewLogEntry creates a new LogEntry with a ULID and current timestamp.

func NewLogEntryWithFields

func NewLogEntryWithFields(service, level, message, component string, fields map[string]interface{}) *LogEntry

NewLogEntryWithFields creates a new LogEntry with structured fields attached. A nil or empty fields map is omitted from the serialized entry.

Jump to

Keyboard shortcuts

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