From a2d595423e4270d8e644212021ba70c70df075d9 Mon Sep 17 00:00:00 2001 From: Maximilian Möhring Date: Tue, 14 May 2019 17:35:18 +0200 Subject: Refactores logging functions. (crawler) --- crawler/shop_rumundco.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'crawler/shop_rumundco.go') diff --git a/crawler/shop_rumundco.go b/crawler/shop_rumundco.go index 86d8b8a..3b7d08a 100644 --- a/crawler/shop_rumundco.go +++ b/crawler/shop_rumundco.go @@ -43,7 +43,7 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { if err != nil { W.error_msg = "Rum & Co: Parsing Query from Shop-URL failed" W.error_ctx = e.Request.URL.String() - PrintlnOffer(W, "Rum & Co: Parsing Query from Shop-URL failed") + W.Println("Rum & Co: Parsing Query from Shop-URL failed") } switch param["kf"][0] { case "29": @@ -58,7 +58,7 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { W.error_msg = "Rum & Co: Query parameter has unexpected value" W.error_ctx = param["kf"][0] W.Url = e.Request.URL.String() - PrintlnOffer(W, "Rum & Co: Detecting spirit type failed") + W.Println("Rum & Co: Detecting spirit type failed") } log.Debug("Rum & Co: Crawling " + W.Spirit_type + " with param kf=" + param["kf"][0]) @@ -75,7 +75,7 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { W.error_ctx = e.ChildText(".delivery-status") W.Url = whisky_url W.Name = whisky_name - PrintlnOffer(W, "Rum & Co: Offer not available") + W.Println("Rum & Co: Offer not available") return } @@ -93,21 +93,21 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { if "" == regular_price { W.error_msg = "Rum & Co: No regular price found" W.error_ctx = regular_price - PrintlnOffer(W, "Rum & Co: No regular price found") + W.Println("Rum & Co: No regular price found") return } W.Original_price, err = convert_price(regular_price) if err != nil { W.error_msg = err.Error() W.error_ctx = regular_price - PrintlnOffer(W, "Rum & Co: Original price: Convert price failed") + W.Println("Rum & Co: Original price: Convert price failed") return } W.Discounted_price, err = convert_price(e.ChildText(".price-value")) if err != nil { W.error_msg = err.Error() W.error_ctx = e.ChildText(".price-value") - PrintlnOffer(W, "Rum & Co: Discounted price: Convert price failed") + W.Println("Rum & Co: Discounted price: Convert price failed") return } @@ -117,7 +117,7 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { if err != nil { W.error_msg = err.Error() W.error_ctx = e.ChildText(".value") - PrintlnOffer(W, "Rum & Co: Base price: Sanitizing base price failed") + W.Println("Rum & Co: Base price: Sanitizing base price failed") return } }) @@ -136,7 +136,7 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { if len(image_url_noisy_slice) < 2 { W.error_msg = "Rum & Co: (Pagespeed) Image URL not found" W.error_ctx = image_url_noisy - PrintlnOffer(W, "Rum & Co: (Pagespeed) Image URL not found") + W.Println("Rum & Co: (Pagespeed) Image URL not found") return } image_url_noisy = strings.Replace(image_url_noisy, image_url_noisy_slice[1], "", 1) @@ -152,7 +152,7 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { if W.Volume == 0 { W.error_msg = "Rum & Co: Volume is zero" W.error_ctx = ctx - PrintlnOffer(W, "Rum & Co: Volume is zero") + W.Println("Rum & Co: Volume is zero") return } @@ -164,14 +164,14 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot { if err != nil { W.error_msg = err.Error() W.error_ctx = abv_noisy - PrintlnOffer(W, "Rum & Co: Base price: Extracting ABV failed") + W.Println("Rum & Co: Base price: Extracting ABV failed") return } } if W.Abv == 0 { W.error_msg = "Rum & Co: Abv is zero" W.error_ctx = abv_noisy - PrintlnOffer(W, "Rum & Co: Abv is zero") + W.Println("Rum & Co: Abv is zero") return } W.Website = e.Request.Ctx.Get("website") -- cgit v1.2.3