Implemented proper logging and added more log messages

This commit is contained in:
ChaoticByte 2023-10-14 10:41:22 +02:00
parent 5a90f9736b
commit 9534dc3492
7 changed files with 89 additions and 23 deletions

View file

@ -66,7 +66,7 @@ func (e ApiEndpoint) getNotices(since time.Time) ([]WidNotice, time.Time, error)
}
notices = parseApiResponse(decodedData, e)
} else {
fmt.Printf("ERROR\tGet \"%v\": %v\n", url, res.Status)
logger.error(fmt.Sprintf("Get \"%v\": %v\n", url, res.Status))
return nil, time.Time{}, err
}
} else {
@ -104,7 +104,7 @@ func parseApiResponse(data map[string]interface{}, apiEndpoint ApiEndpoint) []Wi
}
published, err := time.Parse(PUBLISHED_TIME_FORMAT, d["published"].(string))
if err != nil {
fmt.Println("ERROR\t", err)
logger.error(err)
}
notice.Published = published
// optional fields