log_file

Module custom

Source
Expand description

to log your projects (custom)

§Use

To use the custom log, you need to use 3 steps. At first you will create a new Log. (You can also create more than one log for different usage.)

Just to remind, dont forget to import the custom mudule:

use log_file::custom::*;

Then go on with the creating the Log:

// create Log
let mut log = Log::new(true, ':');

The second step is to use it. In the following I just will show the different options:

// with context as String
log.add("Titel 1",String::from("Context 1"));
 
// with context as &str
log.add_str("Titel 2","Context 2");

If that is done, you can finaly save the log in the end. Here an example for this step:

// save log
log.save("log.txt");

And now you are done. Now, every time you run your project, the new log will overwrite the existing one, if the file name dosn’t change.

Structs§

  • The main struct for the custom log
  • elements (entries) in the log