+Title: logging_content

This is a library intendeted for making logging intermediary results of operations simpler, while also adding context to the current state of operations. Here are some code samples to show the library could be used:

Start by adding the macro calls to where you wan't it's definition in:

+BEGIN_SRC rust

loggingcontent::traitLogContent!(); loggingcontent::traitLogDisplay!(); loggingcontent::implResult!();

+END_SRC

And define how you wan't kown types to be displayed when logging:

+BEGIN_SRC rust

impl LogDisplay for E { fn aslogdisplay(&self, : loggingcontent::Level) -> String { format!("{} ({:?})", self, self) } }

+END_SRC

Then you can easily add some log calls without changing anything inside your Result type.

+BEGIN_SRC rust

// Import LogContent trait from where it was defined use utils::log::LogContent;

let mut input = utils::io::timedbufreader( chunksize, fs::File::open(source).logerrormsg("failed to open source file")?, ); input.seek(SeekFrom::Start(skip)).logerrormsg("failed to seek source file")?; let mut output = utils::io::timedbufwriter( chunksize, fs::OpenOptions::new() .read(true) .write(true) .truncate(truncate) .open(device) .logerrormsg("failed to open output file")?, ); output.seek(SeekFrom::Start(seek)).logerrormsg("failed to seek output file")?;

+END_SRC

The [[examples/resultlogging.rs][resultlogging]] example shows a more self contained example.