Moved package log to logging
This commit is contained in:
1 parent
da81e6ccd9
commit
dd26976f76
3 files changed
+13
-11
No files matched your search
@@ -19,23 +19,23 @@ package cli
|
||||
import (
|
||||
"log/slog"
|
||||
|
||||
"git.avsdev.uk/Go/job-search/internal/log"
|
||||
"git.avsdev.uk/Go/job-search/internal/logging"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func SetupIntialLogging(cmd *cobra.Command) {
|
||||
// Start logging to terminal first - any commands that want to use file
|
||||
// logging should activate it themselves
|
||||
log.LogToTerminal()
|
||||
logging.LogToTerminal()
|
||||
|
||||
// Check for quiet flag
|
||||
if quiet, _ := cmd.Flags().GetBool("quiet"); quiet {
|
||||
log.SetLevel(slog.LevelError)
|
||||
logging.SetLevel(slog.LevelError)
|
||||
}
|
||||
|
||||
// Check for debug logging enabled (overrides quiet flag)
|
||||
debugEnabled, _ := cmd.Flags().GetBool("debug")
|
||||
if debugEnabled {
|
||||
log.EnableDebug()
|
||||
logging.EnableDebug()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user