Inspecting the log

When the Story is parsed it goes through all lines and scenes in the script, inspecting them for inconsistencies and notes. If any errors are encountered the parsing fails, and an error is returned.

However, some inconsistencies are not very serious and do not raise an error. Such issues are instead added to a log, which you can inspect after the parsing has finished. You can then decide whether any yielded warning is sufficient for further investigation.

We recommend that you always check this log and inspect its messages after parsing a story. Besides regular warnings, it will also contain reminders of any to-do comment you have added to the story, which may merit having a look at.

The log supports standard iterator operations, which makes it simple to walk through all warnings and to-do comments at once.


#![allow(unused)]
fn main() {
extern crate inkling;
use inkling::{read_story_from_string, Story};
let content = r#"
TODO: Should these names be in variables?
A single candle flickered by my side.
Pen in hand I procured a blank letter.

*   "Dear Guillaume"
    Sparing the more unfavorable details from him, I requested his aid.

*   "To the Fiendish Impostor"
"#;
let mut story: Story = read_story_from_string(&content).unwrap();

// Print all warnings and comments to standard error for inspection
for message in story.log.iter() {
    eprintln!("{}", message);
}

assert_eq!(story.log.todo_comments.len(), 1);
}