From a4db0628a0377b39be02f0e83832b0c3527933e1 Mon Sep 17 00:00:00 2001 From: Till Höppner Date: Wed, 2 Mar 2016 12:57:36 +0100 Subject: Merging of any number of logs --- formats/energymech/Cargo.toml | 4 ++-- formats/energymech/src/lib.rs | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'formats/energymech') diff --git a/formats/energymech/Cargo.toml b/formats/energymech/Cargo.toml index 09e41b1..b5cad0a 100644 --- a/formats/energymech/Cargo.toml +++ b/formats/energymech/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ilc-format-energymech" -version = "0.1.1" +version = "0.2.0" description = "IRC log converter/collector/cruncher" homepage = "https://github.com/tilpner/ilc" license = "Apache-2.0" @@ -10,4 +10,4 @@ authors = ["Till Höppner "] [dependencies] log = "0.3.5" chrono = "0.2.19" -ilc-base = "0.1.0" +ilc-base = "~0.2" diff --git a/formats/energymech/src/lib.rs b/formats/energymech/src/lib.rs index e0863e7..ed687f0 100644 --- a/formats/energymech/src/lib.rs +++ b/formats/energymech/src/lib.rs @@ -29,6 +29,7 @@ use log::LogLevel::Info; use chrono::*; +#[derive(Copy, Clone)] pub struct Energymech; static TIME_FORMAT: &'static str = "%H:%M:%S"; @@ -219,12 +220,15 @@ impl<'a> Iterator for Iter<'a> { channel: self.context.channel.clone().map(Into::into), })); } + if option_env!("FUSE").is_some() { + panic!("Shouldn't reach here, this is a bug!") + } } } } impl Decode for Energymech { - fn decode<'a>(&'a mut self, + fn decode<'a>(&'a self, context: &'a Context, input: &'a mut BufRead) -> Box>> + 'a> { @@ -250,6 +254,13 @@ impl Encode for Energymech { from, content)) } + &Event { ty: Type::Notice { ref from, ref content }, ref time, .. } => { + try!(writeln!(&mut output, + "[{}] -{}- {}", + time.with_format(&context.timezone, TIME_FORMAT), + from, + content)) + } &Event { ty: Type::Action { ref from, ref content }, ref time, .. } => { try!(writeln!(&mut output, "[{}] * {} {}", @@ -302,7 +313,12 @@ impl Encode for Energymech { nick.as_ref().expect("Nick not present, but required."), new_topic)) } - _ => (), + _ => { + if option_env!("FUSE").is_some() { + panic!("Shouldn't reach here, this is a bug!") + } + () + } } Ok(()) } -- cgit v1.2.3