mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-31 11:33:06 -07:00
pkg/log: create wrapper around logrus
This commit is contained in:
@@ -6,9 +6,9 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/chihaya/chihaya/bittorrent"
|
||||
"github.com/chihaya/chihaya/frontend"
|
||||
"github.com/chihaya/chihaya/pkg/log"
|
||||
"github.com/chihaya/chihaya/pkg/stop"
|
||||
"github.com/chihaya/chihaya/storage"
|
||||
)
|
||||
@@ -61,7 +61,7 @@ func (l *Logic) HandleAnnounce(ctx context.Context, req *bittorrent.AnnounceRequ
|
||||
}
|
||||
}
|
||||
|
||||
log.WithFields(resp.LogFields()).Debug("generated announce response")
|
||||
log.Debug("generated announce response", resp)
|
||||
return ctx, resp, nil
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func (l *Logic) AfterAnnounce(ctx context.Context, req *bittorrent.AnnounceReque
|
||||
var err error
|
||||
for _, h := range l.postHooks {
|
||||
if ctx, err = h.HandleAnnounce(ctx, req, resp); err != nil {
|
||||
log.Errorln("chihaya: post-announce hooks failed:", err.Error())
|
||||
log.Error("post-announce hooks failed", log.Err(err))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ func (l *Logic) HandleScrape(ctx context.Context, req *bittorrent.ScrapeRequest)
|
||||
}
|
||||
}
|
||||
|
||||
log.WithFields(resp.LogFields()).Debug("generated scrape response")
|
||||
log.Debug("generated scrape response", resp)
|
||||
return ctx, resp, nil
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func (l *Logic) AfterScrape(ctx context.Context, req *bittorrent.ScrapeRequest,
|
||||
var err error
|
||||
for _, h := range l.postHooks {
|
||||
if ctx, err = h.HandleScrape(ctx, req, resp); err != nil {
|
||||
log.Errorln("chihaya: post-scrape hooks failed:", err.Error())
|
||||
log.Error("post-scrape hooks failed", log.Err(err))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user