logging

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 8 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 logging provides the always-on, structured JSON-lines file logger for the CLI, with size-based rotation and a redaction layer so credentials can never reach the log. stdout is reserved for data; all logging goes to the file (and, with --debug, mirrored to stderr).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDir

func DefaultDir() (string, error)

DefaultDir returns the default log directory (~/.vibexp/logs).

func Redact

func Redact(s string) string

Redact replaces every registered secret substring in s with the placeholder.

func RegisterSecret

func RegisterSecret(secret string)

RegisterSecret records a secret value so it is redacted anywhere it appears in log output. Short/empty values are ignored to avoid corrupting logs.

Types

type Logger

type Logger struct {
	*slog.Logger
	// contains filtered or unexported fields
}

Logger is the initialized logger plus a Close to flush/close the sink.

func Init

func Init(opts Options) (*Logger, error)

Init builds the always-on logger. It never fails hard on a missing home dir; callers that cannot open the log file get a stderr-only logger so the CLI still runs.

func (*Logger) Close

func (l *Logger) Close() error

Close releases the underlying log file.

type Options

type Options struct {
	// Dir is the directory to write cli.log into. Empty means the default
	// (~/.vibexp/logs).
	Dir string
	// Debug raises the level to Debug and mirrors output to stderr.
	Debug bool
}

Options configures the logger.

Jump to

Keyboard shortcuts

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