@@ -9,19 +9,19 @@ class Crawler < Service
9
9
#
10
10
def call ( website )
11
11
Try [ OpenSSL ::SSL ::SSLError , ::HTTP ::Error , Addressable ::URI ::InvalidURIError ] do
12
- info = "Website:#{ website . info } . "
13
- info = info . colorize ( :red ) if website . kits?
14
- logger . info ( info )
12
+ log_message = "Website:#{ website . defanged_truncated_url } "
13
+ log_message . colorize ( :red ) if website . kits?
14
+ logger . info ( log_message , kits : website . kits . length , source : website . source )
15
15
16
16
website . kits . each do |kit |
17
17
downloader = Downloader . new ( kit )
18
18
result = downloader . result
19
19
unless result . success?
20
- logger . warn ( "Kit:#{ kit . truncated_url } failed to download - #{ result . failure } ." )
20
+ logger . warn ( "Kit:#{ kit . truncated_url } failed to download." , failure : result . failure )
21
21
next
22
22
end
23
23
destination = result . value!
24
- logger . info ( "Kit:#{ kit . truncated_url } downloaded as #{ destination } ." )
24
+ logger . info ( "Kit:#{ kit . truncated_url } downloaded." , dest : destination )
25
25
# Remove downloaded file if auto_download is not allowed
26
26
FileUtils . rm ( destination , force : true ) unless auto_download?
27
27
# Notify the kit
@@ -44,7 +44,7 @@ def notify(kit)
44
44
if result . success?
45
45
logger . info ( "Notifier:#{ notifier . name } succeeded." )
46
46
else
47
- logger . warn ( "Notifier:#{ notifier . name } failed - #{ result . failure } ." )
47
+ logger . warn ( "Notifier:#{ notifier . name } failed." , failure : result . failure )
48
48
end
49
49
end
50
50
end
0 commit comments