summaryrefslogtreecommitdiff
path: root/crawler/sanitize.go
diff options
context:
space:
mode:
authorMaximilian Möhring2019-05-14 17:35:18 +0200
committerMaximilian Möhring2019-05-14 17:35:18 +0200
commita2d595423e4270d8e644212021ba70c70df075d9 (patch)
treea4d7f32400266a47b37d612babf9aa807c93f31d /crawler/sanitize.go
parent64520ffa7b66f6914decf50c43c8698ce47ee1ce (diff)
downloadalkobote-a2d595423e4270d8e644212021ba70c70df075d9.tar.gz
Refactores logging functions. (crawler)
Diffstat (limited to 'crawler/sanitize.go')
-rw-r--r--crawler/sanitize.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/crawler/sanitize.go b/crawler/sanitize.go
index db0faec..25e8a09 100644
--- a/crawler/sanitize.go
+++ b/crawler/sanitize.go
@@ -17,7 +17,7 @@ func sanitize_offer(angebote []Angebot, shop Shop, try int) []Angebot {
for _, offer := range angebote {
if offer.Spirit_type == "Wein" {
- DebugOffer(offer, "Sanitizer: Skip offer because it's wine")
+ offer.Debug("Sanitizer: Skip offer because it's wine")
continue
}
@@ -31,34 +31,34 @@ func sanitize_offer(angebote []Angebot, shop Shop, try int) []Angebot {
continue
}
if offer.Volume == 0 {
- WarnOffer(offer, "Sanitizer: Volume is zero")
+ offer.Warn("Sanitizer: Volume is zero")
continue
}
if offer.Original_price == 0 {
- WarnOffer(offer, "Sanitizer: Original price is zero")
+ offer.Warn("Sanitizer: Original price is zero")
continue
}
if offer.Discounted_price == 0 {
- WarnOffer(offer, "Sanitizer: Discounted price is zero")
+ offer.Warn("Sanitizer: Discounted price is zero")
continue
}
if offer.Base_price == 0 {
- WarnOffer(offer, "Sanitizer: Base price is zero")
+ offer.Warn("Sanitizer: Base price is zero")
continue
}
if offer.Url == "" {
- WarnOffer(offer, "Sanitizer: URL is empty")
+ offer.Warn("Sanitizer: URL is empty")
continue
}
if offer.Image_url == "" {
- WarnOffer(offer, "Sanitizer: Image-URL is empty")
+ offer.Warn("Sanitizer: Image-URL is empty")
continue
}
if err := sanitize_image_url(offer.Image_url); err != nil {
offer.error_ctx = offer.Image_url
offer.error_msg = err.Error()
- WarnOffer(offer, "Sanitizer: Image-URL is not valid")
+ offer.Warn("Sanitizer: Image-URL is not valid")
continue
}
@@ -66,7 +66,7 @@ func sanitize_offer(angebote []Angebot, shop Shop, try int) []Angebot {
offer.Website = ""
if offer.Age == 0 {
- DebugOffer(offer, "GREP")
+ offer.Debug("GREP")
}
W = append(W, offer)
@@ -258,7 +258,7 @@ func _check_abv_for_spirit_type(offer Angebot) bool {
*/
if offer.Abv == 0 {
- WarnOffer(offer, "Sanitizer: Abv is zero")
+ offer.Warn("Sanitizer: Abv is zero")
return false
}