diff options
| author | horus | 2018-02-16 18:06:50 +0100 |
|---|---|---|
| committer | horus | 2018-02-16 18:06:50 +0100 |
| commit | bf5f6b98a1d933d5f0ffb7fe965428f4dab5e3b0 (patch) | |
| tree | c95eb6426b61965b37da2b60da36cfe2c02a92b4 /crawler/shop_whiskyde.go | |
| parent | ed6ab4da59f80bf9fa2cbf15da5c9167dff44ea4 (diff) | |
| download | alkobote-bf5f6b98a1d933d5f0ffb7fe965428f4dab5e3b0.tar.gz | |
Structured logging part two. (crawler)
Diffstat (limited to 'crawler/shop_whiskyde.go')
| -rw-r--r-- | crawler/shop_whiskyde.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crawler/shop_whiskyde.go b/crawler/shop_whiskyde.go index e635546..f13190b 100644 --- a/crawler/shop_whiskyde.go +++ b/crawler/shop_whiskyde.go @@ -1,7 +1,6 @@ package main import ( - log "github.com/Sirupsen/logrus" "strings" "github.com/gocolly/colly" @@ -34,13 +33,13 @@ func ScrapeWhiskyde(shop Shop) []Angebot { e.ForEach(".article-price-original", func(i int, e *colly.HTMLElement) { W.Original_price, err = convert_price(e.ChildText("del")) if err != nil { - log.Fatal(err) + Fatal(err, "Whisky.de: Converting original price failed") } }) e.ForEach(".article-price", func(i int, e *colly.HTMLElement) { W.Discounted_price, err = convert_price(e.ChildText(".article-price-default")) if err != nil { - log.Fatal(err) + Fatal(err, "Whisky.de: Converting discounted price failed") } }) @@ -61,19 +60,19 @@ func ScrapeWhiskyde(shop Shop) []Angebot { abv_noisy := strings.TrimSpace(strings.SplitAfter(text_noisy, "Liter")[1]) W.Volume, err = extract_volume(text_noisy) if err != nil { - log.Fatal(err) + Fatal(err, "Whisky.de: Extracting volume failed") } W.Abv, err = extract_abv(abv_noisy) if err != nil { - log.Fatal(err) + Fatal(err, "Whisky.de: Extracting abv failed") } if W.Volume == 0 { - log.Println("Whisky.de: " + W.Name + " kein Volume erkannt") + DebugOffer(W, "Whisky.de: Volume is zero") return } if W.Abv == 0 { - log.Println("Whisky.de: " + W.Name + " kein Abv erkannt") + DebugOffer(W, "Whisky.de: Abv is zero") return } @@ -82,7 +81,7 @@ func ScrapeWhiskyde(shop Shop) []Angebot { W.Base_price, err = convert_price(e.ChildText(".article-unitprice-default")) if err != nil { - log.Fatal(err) + Fatal(err, "Whisky.de: Converting base price failed") } e.Request.Visit(W.Url) |
