Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
lib:logging [2020/11/08 19:23] – created sprowelllib:logging [2020/11/08 19:32] (current) – [Using Logging] sprowell
Line 13: Line 13:
 To use logging from within the library, simply use the macros provided by the ''log'' crate. To use logging from within the library, simply use the macros provided by the ''log'' crate.
  
-<code rust>+<code Rust [enable_line_numbers=true]>
 use log::{debug,info}; use log::{debug,info};
 //... //...
Line 21: Line 21:
 You can specify a target for the log message as follows: ''info!(target: "lifecycle", "Shutting down");'', and then select that target. You can specify a target for the log message as follows: ''info!(target: "lifecycle", "Shutting down");'', and then select that target.
  
-If you are writing an executable that will use the library, you should enable logging by calling ''relision::main::configure_logging();'' at the start of your executable.+If you are writing an executable that will use the library, you should enable logging by calling ''relision::configure_logging();'' at the start of your executable.