Add comprehensive Go docstrings with examples to all packages to achieve 100% coverage. Refactor the `matrix` package to `tim` (Terminal Isolation Matrix). Update all references to the old package and terminology across the codebase, including commands, tests, and examples. Fix inconsistencies in command-line flags and help text related to the refactoring.
30 lines
717 B
Go
30 lines
717 B
Go
// Package logger provides a simple configurable logger for the application.
|
|
package logger
|
|
|
|
import (
|
|
"log/slog"
|
|
"os"
|
|
)
|
|
|
|
// New creates a new slog.Logger. If verbose is true, the logger will be
|
|
// configured to show debug messages. Otherwise, it will only show info
|
|
// level and above.
|
|
//
|
|
// Example:
|
|
//
|
|
// // Create a standard logger
|
|
// log := logger.New(false)
|
|
// log.Info("This is an info message")
|
|
//
|
|
// // Create a verbose logger
|
|
// verboseLog := logger.New(true)
|
|
// verboseLog.Debug("This is a debug message")
|
|
func New(verbose bool) *slog.Logger {
|
|
level := slog.LevelInfo
|
|
if verbose {
|
|
level = slog.LevelDebug
|
|
}
|
|
return slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
|
|
Level: level,
|
|
}))
|
|
}
|