package log //nolint:revive,nolintlint // stdlib log unused here; see #76 import ( "go.uber.org/fx" ) // Module exports logging functionality for dependency injection. // //nolint:gochecknoglobals // fx module definitions are package globals var Module = fx.Module("log", fx.Invoke(func(cfg Config) { Initialize(cfg) }), ) // New creates a new logger configuration from provided options. // // JSON is intentionally not carried into Config: a command emitting a // JSON document on stdout must keep its stderr log level under // --verbose/--debug, so --json must not lower it (issue #112). JSON // silences the stdout UI in setupGlobals instead. func New(opts Options) Config { return Config{ Verbose: opts.Verbose, Debug: opts.Debug, Cron: opts.Cron, Quiet: opts.Quiet, } } // Options are provided by the CLI. type Options struct { Verbose bool Debug bool Cron bool Quiet bool // JSON marks a command whose stdout carries a machine-readable // document. It silences the human UI on stdout (see setupGlobals), // but unlike Quiet it leaves the stderr log level alone. JSON bool }