applog

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package applog is the single owner of where process log output goes.

The log file is a disposable diagnostic, never origin data: it is not exported, not synced, and not the record of anything. Call sites keep using the standard log package; this package only sets the destination and scrubs credential-shaped bytes on the way in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(dir string) (func(), error)

Install opens <dir>/logs/gadak.log and points the standard log package at a writer that scrubs credential-shaped bytes, appends them to that file, and mirrors them to stderr. A second call in one process is a no-op that returns the same closer.

A file that cannot be opened (a read-only home is a supported state) does not fail the process: Install logs one line to stderr and continues with stderr-only output plus the in-memory ring. The returned error names the open failure; callers at process start must ignore it.

func Path

func Path(dir string) string

Path is <dir>/logs/gadak.log — the file Install opens.

func Recent

func Recent(n int) []string

Recent returns the last n lines written through Install, oldest first. n is capped at 500. Without Install, the result is empty.

func Tail

func Tail(dir string, n int) []string

Tail returns the last n lines of the log file at Path(dir), oldest first. It exists because the ring is process-local and `gadak doctor` is its own process: without this, doctor's log section can only ever be empty, which is the one place the lines were meant to be pasteable from.

The bytes on disk are already scrubbed, but they were scrubbed by whichever build wrote them; running them back through scrub costs nothing and keeps the never-print rule owned here rather than at the reader.

Types

This section is empty.

Jump to

Keyboard shortcuts

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