summaryrefslogtreecommitdiffstats
path: root/commands/hugo.go
diff options
context:
space:
mode:
authorMax Rydahl Andersen <max.andersen@gmail.com>2017-07-27 22:36:22 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-07-27 22:36:22 +0200
commitaee2b06780858c12d8cb04c7b1ba592543410aa9 (patch)
tree2f74b0cdf3096126c2bfa005376365661cdd8e4a /commands/hugo.go
parentc1a5da9777adb81ad170a9391210dbfd047c4e48 (diff)
Add --debug option to be improved on over time
Why: * first time using hugo I got very little info from --verbose output but I noticed there is quite a lot of useful DEBUG logging * asked for in other issues like https://github.com/gohugoio/hugo/issues/3514 This change addreses the need by: * adding a simple --debug flag which simply turns on debug level in stdout and logoutput if enabled.
Diffstat (limited to 'commands/hugo.go')
-rw-r--r--commands/hugo.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 3210cdba6..d8527a3aa 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -143,6 +143,7 @@ var (
renderToMemory bool // for benchmark testing
verbose bool
verboseLog bool
+ debug bool
quiet bool
)
@@ -263,6 +264,7 @@ func initBenchmarkBuildingFlags(cmd *cobra.Command) {
// init initializes flags.
func init() {
HugoCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
+ HugoCmd.PersistentFlags().BoolVarP(&debug, "debug", "", false, "debug output")
HugoCmd.PersistentFlags().BoolVar(&logging, "log", false, "enable Logging")
HugoCmd.PersistentFlags().StringVar(&logFile, "logFile", "", "log File path (if set, logging enabled automatically)")
HugoCmd.PersistentFlags().BoolVar(&verboseLog, "verboseLog", false, "verbose logging")
@@ -432,8 +434,15 @@ func createLogger(cfg config.Provider) (*jww.Notepad, error) {
stdoutThreshold = jww.LevelInfo
}
+ if cfg.GetBool("debug") {
+ stdoutThreshold = jww.LevelDebug
+ }
+
if verboseLog {
logThreshold = jww.LevelInfo
+ if cfg.GetBool("debug") {
+ logThreshold = jww.LevelDebug
+ }
}
// The global logger is used in some few cases.
@@ -446,7 +455,7 @@ func createLogger(cfg config.Provider) (*jww.Notepad, error) {
}
func (c *commandeer) initializeFlags(cmd *cobra.Command) {
- persFlagKeys := []string{"verbose", "logFile"}
+ persFlagKeys := []string{"debug", "verbose", "logFile"}
flagKeys := []string{
"cleanDestinationDir",
"buildDrafts",