mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Fix some recently broken embedded templates
And add tests for them. Fixes #4757
This commit is contained in:
@@ -260,7 +260,8 @@ func (p *PathSpec) ThemeSet() bool {
|
||||
return p.theme != ""
|
||||
}
|
||||
|
||||
type logPrinter interface {
|
||||
// LogPrinter is the common interface of the JWWs loggers.
|
||||
type LogPrinter interface {
|
||||
// Println is the only common method that works in all of JWWs loggers.
|
||||
Println(a ...interface{})
|
||||
}
|
||||
@@ -268,7 +269,7 @@ type logPrinter interface {
|
||||
// DistinctLogger ignores duplicate log statements.
|
||||
type DistinctLogger struct {
|
||||
sync.RWMutex
|
||||
logger logPrinter
|
||||
logger LogPrinter
|
||||
m map[string]bool
|
||||
}
|
||||
|
||||
@@ -309,6 +310,11 @@ func NewDistinctErrorLogger() *DistinctLogger {
|
||||
return &DistinctLogger{m: make(map[string]bool), logger: jww.ERROR}
|
||||
}
|
||||
|
||||
// NewDistinctLogger creates a new DistinctLogger that logs to the provided logger.
|
||||
func NewDistinctLogger(logger LogPrinter) *DistinctLogger {
|
||||
return &DistinctLogger{m: make(map[string]bool), logger: logger}
|
||||
}
|
||||
|
||||
// NewDistinctWarnLogger creates a new DistinctLogger that logs WARNs
|
||||
func NewDistinctWarnLogger() *DistinctLogger {
|
||||
return &DistinctLogger{m: make(map[string]bool), logger: jww.WARN}
|
||||
|
Reference in New Issue
Block a user