mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
parent
85c5b89593
commit
c8b5ab75b7
4 changed files with 22 additions and 6 deletions
|
@ -331,12 +331,14 @@ func (l *DistinctLogger) Warnf(format string, v ...interface{}) {
|
|||
l.Logger.Warnf(format, v...)
|
||||
})
|
||||
}
|
||||
|
||||
func (l *DistinctLogger) Warnln(v ...interface{}) {
|
||||
logStatement := fmt.Sprint(v...)
|
||||
l.printIfNotPrinted("warnln", logStatement, func() {
|
||||
l.Logger.Warnln(v...)
|
||||
})
|
||||
}
|
||||
|
||||
func (l *DistinctLogger) Errorf(format string, v ...interface{}) {
|
||||
logStatement := fmt.Sprint(v...)
|
||||
l.printIfNotPrinted("errorf", logStatement, func() {
|
||||
|
@ -396,7 +398,6 @@ var (
|
|||
func InitLoggers() {
|
||||
DistinctErrorLog.Reset()
|
||||
DistinctWarnLog.Reset()
|
||||
|
||||
}
|
||||
|
||||
// Deprecated informs about a deprecation, but only once for a given set of arguments' values.
|
||||
|
@ -408,7 +409,11 @@ func Deprecated(item, alternative string, err bool) {
|
|||
if err {
|
||||
DistinctErrorLog.Errorf("%s is deprecated and will be removed in Hugo %s. %s", item, hugo.CurrentVersion.Next().ReleaseVersion(), alternative)
|
||||
} else {
|
||||
DistinctWarnLog.Warnf("%s is deprecated and will be removed in a future release. %s", item, alternative)
|
||||
var warnPanicMessage string
|
||||
if !loggers.PanicOnWarning {
|
||||
warnPanicMessage = "\n\nRe-run Hugo with the flag --panicOnWarning to get a better error message."
|
||||
}
|
||||
DistinctWarnLog.Warnf("%s is deprecated and will be removed in a future release. %s%s", item, alternative, warnPanicMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue