Browse code

Fixed logging

Julio Biason authored on 17/05/2019 09:17:24
Showing 1 changed files

... ...
@@ -13,7 +13,6 @@ use reqwest;
13 13
 
14 14
 use hyper::Uri;
15 15
 
16
-#[macro_use]
17 16
 use log;
18 17
 use env_logger;
19 18
 
... ...
@@ -32,7 +31,7 @@ fn main() {
32 31
         mastodon
33 32
     };
34 33
 
35
-    info!("Starting up...");
34
+    log::info!("Starting up...");
36 35
     client
37 36
         .favourites()
38 37
         .unwrap()
... ...
@@ -42,7 +41,7 @@ fn main() {
42 41
 }
43 42
 
44 43
 fn dump_record(record: Status) -> () {
45
-    debug!("Retriving record {}", record.id);
44
+    log::debug!("Retriving record {}", record.id);
46 45
     create_structure(&record);
47 46
     save_content(&record);
48 47
     save_attachments(&record);
... ...
@@ -60,14 +59,14 @@ fn create_structure(record: &Status) -> () {
60 59
 
61 60
 fn save_content(record: &Status) -> () {
62 61
     if let Ok(mut fp) = File::create(toot_dir(&record).join("toot.md")) {
63
-        debug!("Saving content of {}..", record.id);
62
+        log::debug!("Saving content of {}..", record.id);
64 63
         fp.write_all(html2md::parse_html(&record.content).as_bytes())
65 64
             .expect("Failed to save content");
66 65
     }
67 66
 }
68 67
 
69 68
 fn save_attachments(record: &Status) -> () {
70
-    debug!("Saving attachments of {}...", record.id);
69
+    log::debug!("Saving attachments of {}...", record.id);
71 70
     let base_path = toot_dir(&record);
72 71
     record
73 72
         .media_attachments
... ...
@@ -76,7 +75,7 @@ fn save_attachments(record: &Status) -> () {
76 75
 }
77 76
 
78 77
 fn save_attachment(attachment: &Attachment, base_path: &PathBuf) -> () {
79
-    debug!("Saving attachment {}", attachment.url);
78
+    log::debug!("Saving attachment {}", attachment.url);
80 79
     let uri: Uri = attachment.url.parse().expect("Invalid URL");
81 80
     let body = reqwest::get(&attachment.url)
82 81
         .expect("Failed to connect to server")