jsonlog

package
v0.1.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 7 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 jsonlog appends records to a JSON Lines file that rotates by size: the API audit log and the webhook delivery log. Files are mode 0600 in a 0700 directory, because both name tokens and endpoints.

Index

Constants

View Source
const DefaultMaxBytes = 5 << 20

DefaultMaxBytes is the size at which a log rotates.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

type Log struct {
	Path string
	// MaxBytes rotates the file before a write would take it past this;
	// zero is DefaultMaxBytes.
	MaxBytes int64
	// Keep is how many rotated files to keep; zero keeps one.
	Keep int
	// contains filtered or unexported fields
}

Log is one rotating JSON Lines file. Path.1 is the previous file; Keep older ones are kept as Path.2 and so on.

func (*Log) Append

func (l *Log) Append(v any) error

Append writes v as one line.

func (*Log) Tail

func (l *Log) Tail(n int) ([]json.RawMessage, error)

Tail returns up to n of the newest records of the current file, oldest first, each as raw JSON. A missing file is no records.

Jump to

Keyboard shortcuts

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