logger

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package logger provides optional file-based logging for gemtracker.

When verbose mode is enabled, logs are written to ~/.cache/gemtracker/gemtracker.log. When disabled, uses io.Discard for zero overhead. All logging functions are thread-safe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close closes the log file if one was opened. Should be called via defer in main(). Returns an error if the file cannot be closed. Safe to call if logging is disabled.

func Error

func Error(format string, v ...interface{})

Error logs an error message with [ERROR] prefix. Thread-safe. No-op if logger has not been initialized.

func Info

func Info(format string, v ...interface{})

Info logs an informational message with [INFO] prefix. Thread-safe. No-op if logger has not been initialized.

func Init

func Init(verbose bool) error

Init initializes the logger. If verbose is false, logging is disabled using io.Discard with zero overhead. If verbose is true, opens ~/.cache/gemtracker/gemtracker.log for appending with timestamps. Returns an error if the log file cannot be created or opened.

func Warn

func Warn(format string, v ...interface{})

Warn logs a warning message with [WARN] prefix. Thread-safe. No-op if logger has not been initialized.

Types

This section is empty.

Jump to

Keyboard shortcuts

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