Improved avatar log

This commit is contained in:
2017-06-16 13:48:11 +02:00
parent 47a7940e32
commit 627eae999b
4 changed files with 14 additions and 9 deletions

View File

@ -11,6 +11,8 @@ import (
"github.com/parnurzeal/gorequest"
)
var netLog = avatarLog.NewChannel("NET")
// Avatar represents a single image and the name of the format.
type Avatar struct {
User *arn.User
@ -37,13 +39,13 @@ func AvatarFromURL(url string, user *arn.User) *Avatar {
// Network errors
if networkErr != nil {
avatarLog.Error("NET", user.Nick, url, networkErr)
netLog.Error(user.Nick, url, networkErr)
return nil
}
// Bad status codes
if response.StatusCode != http.StatusOK {
avatarLog.Error("NET", user.Nick, url, response.StatusCode)
netLog.Error(user.Nick, url, response.StatusCode)
return nil
}
@ -51,7 +53,7 @@ func AvatarFromURL(url string, user *arn.User) *Avatar {
img, format, decodeErr := image.Decode(bytes.NewReader(data))
if decodeErr != nil {
avatarLog.Error("IMG", user.Nick, url, decodeErr)
netLog.Error(user.Nick, url, decodeErr)
return nil
}