From dbc776292acbeb6ef8bbe043302d3d0d2c066261 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 12 Oct 2016 02:04:44 -0400 Subject: [PATCH] easier to read logs; dictionary tweaks --- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + dictionary/IMPROVE.md | 6 ++++++ dictionary/cmudict-0.7b | 12 ++++++------ dictionary/extra-dict | 2 ++ src/logger.rs | 12 ++++++++---- src/main.rs | 1 + 7 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3157d90dc4..9f4e3b785a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,7 @@ name = "trumpet" version = "0.6.0" dependencies = [ + "chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", "clap 1.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "hound 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -59,6 +60,16 @@ name = "buf_redux" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "chrono" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "clap" version = "1.5.5" diff --git a/Cargo.toml b/Cargo.toml index a5fa8b9d7d..092fe4413c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ [dependencies] #cpal = "*" # Hardware audio output (for testing); works well with Hound. + chrono = { version = "0.2.*", features = ["rustc-serialize"] } clap = "1.5.*" # CLI parsing. hound = "2.0.*" # WAV codec. hyper = "0.9.*" diff --git a/dictionary/IMPROVE.md b/dictionary/IMPROVE.md index 523173a6e2..97670da361 100644 --- a/dictionary/IMPROVE.md +++ b/dictionary/IMPROVE.md @@ -1,5 +1,8 @@ These words need improvement ---------------------------- +"^^ bill's +"^^ hillary's +"^^ obama's "^^^ again (BAD) "^^^ how (THIS IS SO BAD) "^^^ then (BAD) @@ -42,8 +45,10 @@ engage ever everybody's everywhere +forgot four fuck +fucked (use fuck as a phone base) gas gigantic goddamn @@ -55,6 +60,7 @@ hispanic hitler home horrible +important invasion invention japanese diff --git a/dictionary/cmudict-0.7b b/dictionary/cmudict-0.7b index 0986889660..e0d2bee55b 100644 --- a/dictionary/cmudict-0.7b +++ b/dictionary/cmudict-0.7b @@ -9859,8 +9859,8 @@ BEG B EH1 G BEGAJAH B EH0 G AA1 JH AH0 BEGALA B EH0 G AA1 L AH0 BEGALA'S B EH0 G AA1 L AH0 Z -BEGAN B IH0 G AE1 N -BEGAN(1) B IY0 G AE1 N +BEGAN(1) B IH0 G AE1 N +BEGAN B IY0 G AE1 N BEGAT B IH0 G AE1 T BEGAY B EH1 G EY0 BEGEL B EY1 G AH0 L @@ -42170,8 +42170,8 @@ FINANCIAL'S(1) F IH0 N AE1 N SH AH0 L Z FINANCIALLY F AH0 N AE1 N SH AH0 L IY0 FINANCIALLY(1) F IH0 N AE1 N SH AH0 L IY0 FINANCIALLY(2) F AY2 N AE1 N SH AH0 L IY0 -FINANCIALS F AY2 N AE1 N SH AH0 L Z -FINANCIALS(1) F IH0 N AE1 N SH AH0 L Z +FINANCIALS(1) F AY2 N AE1 N SH AH0 L Z +FINANCIALS F IH0 N AE1 N SH AH0 L Z FINANCIALS(2) F AH0 N AE1 N SH AH0 L Z FINANCIER F IH2 N AH0 N S IY1 R FINANCIER(1) F AY2 N AE0 N S IY1 R @@ -88174,8 +88174,8 @@ PAGENKOPF P AE1 G AH0 N K AO0 P F PAGENKOPF(1) P AE1 G AH0 N K AO0 F PAGER P EY1 JH ER0 PAGERS P EY1 JH ER0 Z -PAGES P EY1 JH AH0 Z -PAGES(1) P EY1 JH IH0 Z +PAGES(1) P EY1 JH AH0 Z +PAGES P EY1 JH IH0 Z PAGET P AE1 JH AH0 T PAGETT P AE1 JH AH0 T PAGETTE P AE2 JH EH1 T diff --git a/dictionary/extra-dict b/dictionary/extra-dict index 7ee8810b32..b83b517fe1 100644 --- a/dictionary/extra-dict +++ b/dictionary/extra-dict @@ -36,6 +36,8 @@ HARAMBE HH AH1 R AH0 M B IY2 HARAMBE'S HH AH1 R AH0 M B IY2 Z HOSTNAME HH OW1 S T N EY1 M JIGGLYPUFF JH IH1 G L IY0 P AH1 F +JIZZ JH IH0 Z +JIZZING JH IH0 Z IH0 NG KART K AA1 R T KAZOOIE K AH0 Z UW1 IY0 KAZOOIE'S K AH0 Z UW1 IY0 Z diff --git a/src/logger.rs b/src/logger.rs index d42886e727..a5bd91040d 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -1,5 +1,7 @@ // Copyright (c) 2015-2016 Brandon Thomas +use chrono::DateTime; +use chrono::Local; use config::Config; use log::LogLevel; use log::LogLevelFilter; @@ -7,7 +9,6 @@ use log::LogMetadata; use log::LogRecord; use log::SetLoggerError; use log; -use time::now; /// Simple logger example taken from rust-lang.org docs. pub struct SimpleLogger { @@ -42,9 +43,12 @@ impl log::Log for SimpleLogger { fn log(&self, record: &LogRecord) { if self.enabled(record.metadata()) { - let time = now(); - let timestamp = time.rfc3339(); - println!("[{}] {} - {}", timestamp, record.level(), record.args()); + //let utc: DateTime = UTC::now(); + let time: DateTime = Local::now(); + let timestamp = time.format("%a %H:%M:%S"); + let target = record.metadata().target(); + + println!("[{}] {} - {} - {}", timestamp, record.level(), target, record.args()); } } } diff --git a/src/main.rs b/src/main.rs index 30bea79b8a..9cea4aa7a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; +extern crate chrono; extern crate clap; extern crate crypto; extern crate hound;