mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
commands, helpers, vendor: Update to the latest jww logger
Updates #2701
This commit is contained in:
parent
2ac9817eae
commit
c344b1901f
3 changed files with 20 additions and 8 deletions
|
@ -17,6 +17,7 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -332,15 +333,26 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
|
|||
viper.Set("cacheDir", helpers.GetTempDir("hugo_cache", hugofs.Source()))
|
||||
}
|
||||
|
||||
logFile := ioutil.Discard
|
||||
|
||||
if verboseLog || logging || (viper.IsSet("logFile") && viper.GetString("logFile") != "") {
|
||||
|
||||
var err error
|
||||
if viper.IsSet("logFile") && viper.GetString("logFile") != "" {
|
||||
jww.SetLogFile(viper.GetString("logFile"))
|
||||
} else {
|
||||
jww.UseTempLogFile("hugo")
|
||||
path := viper.GetString("logFile")
|
||||
logFile, err = os.OpenFile(path, os.O_RDWR|os.O_APPEND|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
return newSystemError("Failed to open log file:", path, err)
|
||||
}
|
||||
} else {
|
||||
jww.DiscardLogging()
|
||||
logFile, err = ioutil.TempFile(os.TempDir(), "hugo")
|
||||
if err != nil {
|
||||
return newSystemError(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jww.SetLogOutput(logFile)
|
||||
|
||||
if quiet {
|
||||
jww.SetStdoutThreshold(jww.LevelError)
|
||||
|
|
|
@ -252,7 +252,7 @@ func NewDistinctErrorLogger() *DistinctLogger {
|
|||
// NewDistinctFeedbackLogger creates a new DistinctLogger that can be used
|
||||
// to give feedback to the user while not spamming with duplicates.
|
||||
func NewDistinctFeedbackLogger() *DistinctLogger {
|
||||
return &DistinctLogger{m: make(map[string]bool), logger: &jww.FEEDBACK}
|
||||
return &DistinctLogger{m: make(map[string]bool), logger: jww.FEEDBACK}
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
|
@ -281,10 +281,10 @@
|
|||
"revisionTime": "2016-11-30T04:45:28Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "dkruahfhuLXXuyeCuRpsWlcRK+8=",
|
||||
"checksumSHA1": "7NGKyJZL8VItCxYkEJxNh8l9O18=",
|
||||
"path": "github.com/spf13/jwalterweatherman",
|
||||
"revision": "33c24e77fb80341fe7130ee7c594256ff08ccc46",
|
||||
"revisionTime": "2016-03-01T12:00:06Z"
|
||||
"revision": "14fe3f27973f14e5d1bb8bb16f6153cc67b30652",
|
||||
"revisionTime": "2017-01-03T11:13:15Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "zLJY+lsX1e5OO6gRxQd5RfKgdQY=",
|
||||
|
|
Loading…
Reference in a new issue