package cli import ( "log/slog" "github.com/spf13/cobra" "git.avsdev.uk/Go/job-search/internal/logging" ) // SetupInitialLogging starts logging to the terminal, at the level set by // cmd's --quiet and --debug flags (--debug wins), before any configuration // is loaded. func SetupInitialLogging(cmd *cobra.Command) { // Start logging to terminal first - any commands that want to use file // logging should activate it themselves logging.LogToTerminal() // Check for quiet flag if quiet, _ := cmd.Flags().GetBool("quiet"); quiet { logging.SetLevel(slog.LevelError) } // Check for debug logging enabled (overrides quiet flag) debugEnabled, _ := cmd.Flags().GetBool("debug") if debugEnabled { logging.EnableDebug() } }