debug

package
v0.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package debug provides a file-based debug logger activated by AURA_DEBUG=1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close closes the global logger.

func Init

func Init(configDir string, enabled bool)

Init sets up the global logger. Safe to call multiple times — first call wins.

func Log

func Log(format string, args ...any)

Log writes to the global logger. No-op if not initialized or disabled.

func Span

func Span(name string) func()

Span starts a timed span on the global logger.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger writes timestamped debug output to <configDir>/debug.log. All methods are safe to call on a nil receiver (no-op). Methods are protected by a mutex for concurrent use from multiple goroutines.

func Global

func Global() *Logger

Global returns the global logger (may be nil if not initialized or disabled).

func New

func New(configDir string, enabled bool) *Logger

New returns a Logger if enabled is true, otherwise nil. The log file is written to configDir/debug.log.

func (*Logger) Close

func (l *Logger) Close()

Close closes the log file.

func (*Logger) Log

func (l *Logger) Log(format string, args ...any)

Log writes a formatted debug line with timestamp.

func (*Logger) Span

func (l *Logger) Span(name string) func()

Span logs the start of a named phase and returns a function that logs its duration.

Jump to

Keyboard shortcuts

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