Documentation
¶
Index ¶
- Variables
- func Auth() *slog.Logger
- func ClientAPI() *slog.Logger
- func ClientCache() *slog.Logger
- func ClientConnection() *slog.Logger
- func ClientCore() *slog.Logger
- func ClientData() *slog.Logger
- func ClientMain() *slog.Logger
- func ClientSession() *slog.Logger
- func ClientTools() *slog.Logger
- func Close() *slog.Logger
- func Config() *slog.Logger
- func DB() *slog.Logger
- func DBPurge() *slog.Logger
- func DBQuery() *slog.Logger
- func DBStore() *slog.Logger
- func Event() *slog.Logger
- func GetAllComponents() []string
- func GetLogger(component string) *slog.Logger
- func InitializeLoggers(cfg *cfgType.ServerConfig)
- func Log() *slog.Logger
- func NewMultiHandler(handlers ...slog.Handler) slog.Handler
- func RelayAPI() *slog.Logger
- func RelayClient() *slog.Logger
- func RelayConnection() *slog.Logger
- func Req() *slog.Logger
- func StartPeriodicLogTrimmer(logFilePath string, maxSizeMB int, checkIntervalMinutes int, backupCount int)
- func Startup() *slog.Logger
- func Util() *slog.Logger
- func Validation() *slog.Logger
- type JSONLogWriter
- func (j *JSONLogWriter) Close()
- func (j *JSONLogWriter) Enabled(ctx context.Context, level slog.Level) bool
- func (j *JSONLogWriter) Handle(ctx context.Context, r slog.Record) error
- func (j *JSONLogWriter) WithAttrs(attrs []slog.Attr) slog.Handler
- func (j *JSONLogWriter) WithGroup(name string) slog.Handler
- type LoggerRegistry
- type PrettyLogWriter
Constants ¶
This section is empty.
Variables ¶
var Registry = &LoggerRegistry{ loggers: make(map[string]*slog.Logger), suppressedComponents: make(map[string]bool), }
Global registry instance
Functions ¶
func ClientCache ¶ added in v0.4.1
func ClientConnection ¶ added in v0.4.1
func ClientCore ¶ added in v0.4.1
func ClientData ¶ added in v0.4.1
func ClientMain ¶ added in v0.4.1
func ClientSession ¶ added in v0.4.1
func ClientTools ¶ added in v0.4.1
func GetAllComponents ¶ added in v0.4.1
func GetAllComponents() []string
GetAllComponents returns every component name emitted by the functions above. Keep this in sync with them — it's the source the dashboard and config validation read.
func InitializeLoggers ¶
func InitializeLoggers(cfg *cfgType.ServerConfig)
InitializeLoggers sets up the central logging system with the given configuration
func NewMultiHandler ¶ added in v0.6.0
NewMultiHandler returns a slog.Handler that fans Handle/WithAttrs/ WithGroup calls out to all provided handlers. nil entries are skipped.
func RelayClient ¶ added in v0.4.1
func RelayConnection ¶ added in v0.4.1
func StartPeriodicLogTrimmer ¶
func StartPeriodicLogTrimmer(logFilePath string, maxSizeMB int, checkIntervalMinutes int, backupCount int)
StartPeriodicLogTrimmer starts a goroutine that periodically checks and manages log size
func Startup ¶ added in v0.4.1
Logging components, defined in one place. Each function names the component it logs under; GetAllComponents below MUST list exactly these names (it drives the dashboard's per-component suppression and the config validation).
DB components: "db" is general nostrdb lifecycle (open/close/duplicate checks), "db-store" writes/deletes, "db-query" reads (incl. search + count), "db-purge" retention (scheduled purge + expiration). The nostrdb package calls these functions — there are no ad-hoc GetLogger("...") component strings outside this file, so this list is authoritative.
func Validation ¶
Types ¶
type JSONLogWriter ¶
type JSONLogWriter struct {
// contains filtered or unexported fields
}
JSONLogWriter writes logs in a pretty-printed JSON array format
func NewJSONLogWriter ¶
func NewJSONLogWriter(filePath string, level slog.Level, maxSizeMB int, backupCount int, suppressedComponents map[string]bool) *JSONLogWriter
NewJSONLogWriter creates a new instance of JSONLogWriter
func (*JSONLogWriter) Close ¶
func (j *JSONLogWriter) Close()
Close is now a no-op since logs are written properly on each entry.
type LoggerRegistry ¶
type LoggerRegistry struct {
// contains filtered or unexported fields
}
LoggerRegistry maintains a map of all loggers by component name
type PrettyLogWriter ¶
type PrettyLogWriter struct {
// contains filtered or unexported fields
}
PrettyLogWriter writes logs ONLY to a file