logx

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 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 logx provides structured logging with an in-memory ring buffer so the dashboard can tail recent lines without touching the filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalEntries

func MarshalEntries(entries []Entry) ([]byte, error)

MarshalEntries is a helper for API responses.

func Setup

func Setup(level string, path string, jsonOut bool) error

Setup installs the global logger. When path is non-empty, records are also appended to that file as JSON lines.

func Subscribe

func Subscribe() (<-chan Entry, func())

Subscribe streams new entries until the returned cancel func runs.

Types

type Entry

type Entry struct {
	Time    time.Time      `json:"time"`
	Level   string         `json:"level"`
	Message string         `json:"message"`
	Source  string         `json:"source,omitempty"`
	Attrs   map[string]any `json:"attrs,omitempty"`
}

Entry is one captured log record.

func Tail

func Tail(n int, level, contains string) []Entry

Tail returns up to n most recent entries, oldest first, optionally filtered.

Jump to

Keyboard shortcuts

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