Skip to content

Commit

Permalink
Logging with plugin context
Browse files Browse the repository at this point in the history
  • Loading branch information
dewey committed Aug 17, 2018
1 parent 4d0f752 commit 651356b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/scmp/scmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type plugin struct {
// NewChecker initializes a new dashboard exporter
func NewPlugin(l log.Logger, c *http.Client) *plugin {
return &plugin{
l: l,
l: log.With(l, "plugin", "scmp"),
c: c,
f: &feeds.Feed{
Title: "South China Morning Post",
Expand Down Expand Up @@ -68,7 +68,7 @@ func (p *plugin) Run() (*feeds.Feed, error) {
for i := 1; i < 2; i++ {
u, err := url.Parse(r.URL)
if err != nil {
fmt.Println(err)
p.l.Log("err", err)
continue
}
q := u.Query()
Expand Down
2 changes: 1 addition & 1 deletion runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *Runner) Start() {
return
}
wg.Done()
r.l.Log("msg", "scrape finished", "plugin", cp.String(), "feed_items", ss.Items)
log.With(r.l, "plugin", cp.String()).Log("msg", "scrape finished", "feed_items", ss.Items)
}(cp)
}
wg.Wait()
Expand Down

0 comments on commit 651356b

Please sign in to comment.