summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-01-03 17:28:51 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-01-07 17:06:35 +0100
commit45e3ed517a17648d54e8ce33618a8f251cfec603 (patch)
tree160a1bbd03a107be08ae76018fb382268365e2a1 /hugolib/shortcode.go
parent24a286791f37cbf6638b37f29386949045d0bba2 (diff)
all: Refactor to non-global logger
Note that this looks like overkill for just the logger, and that is correct, but this will make sense once we start with the template handling etc. Updates #2701
Diffstat (limited to 'hugolib/shortcode.go')
-rw-r--r--hugolib/shortcode.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index a08b76339..8e9dc756f 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -27,7 +27,6 @@ import (
bp "github.com/spf13/hugo/bufferpool"
"github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/tpl"
- jww "github.com/spf13/jwalterweatherman"
)
// ShortcodeWithPage is the "." context in a shortcode template.
@@ -215,7 +214,7 @@ func renderShortcode(sc shortcode, parent *ShortcodeWithPage, p *Page, t tpl.Tem
tmpl := getShortcodeTemplate(sc.name, t)
if tmpl == nil {
- jww.ERROR.Printf("Unable to locate template for shortcode '%s' in page %s", sc.name, p.BaseFileName())
+ p.s.log.ERROR.Printf("Unable to locate template for shortcode '%s' in page %s", sc.name, p.BaseFileName())
return ""
}
@@ -233,7 +232,7 @@ func renderShortcode(sc shortcode, parent *ShortcodeWithPage, p *Page, t tpl.Tem
case shortcode:
inner += renderShortcode(innerData.(shortcode), data, p, t)
default:
- jww.ERROR.Printf("Illegal state on shortcode rendering of '%s' in page %s. Illegal type in inner data: %s ",
+ p.s.log.ERROR.Printf("Illegal state on shortcode rendering of '%s' in page %s. Illegal type in inner data: %s ",
sc.name, p.BaseFileName(), reflect.TypeOf(innerData))
return ""
}
@@ -287,7 +286,7 @@ func extractAndRenderShortcodes(stringToParse string, p *Page, t tpl.Template) (
if err != nil {
// try to render what we have whilst logging the error
- jww.ERROR.Println(err.Error())
+ p.s.log.ERROR.Println(err.Error())
}
// Save for reuse
@@ -585,8 +584,9 @@ func renderShortcodeWithPage(tmpl *template.Template, data *ShortcodeWithPage) s
err := tmpl.Execute(buffer, data)
isInnerShortcodeCache.RUnlock()
if err != nil {
- jww.ERROR.Println("error processing shortcode", tmpl.Name(), "\n ERR:", err)
- jww.WARN.Println(data)
+ // TODO(bep) globals
+ data.Page.s.log.ERROR.Println("error processing shortcode", tmpl.Name(), "\n ERR:", err)
+ data.Page.s.log.WARN.Println(data)
}
return buffer.String()
}