goolog 0.2.1

A wrapper library with a predefined log format.
Documentation

goolog

This library provides a function for initiating a fern Logger with some custom formatting and macros to simplify printing logs.

Features

  • timestamp -> This feature is activated by default. Deactivating this feature will cause the logger to skip printing timestamps, which can be useful when programming for an embedded system that does not support timestamps.

Example

To print log messages to the console and, if specified, to a file, this library internally uses the log and fern crates. But to simplify printing a custom sender name, one can also use these library macro`:

use goolog::*;

fn main() {
    // Initializing the logger
    // If one decided to pass a path to this function, the logger would also print the log messages to the file specified.
    init_logger(None);

    // See the macros module for all possible log types.
    info!("Main", "Initialized the goolog logger.");
}

The code above will result in the following output:

29.05.2023 | 14:34:33 | Main             | INFO  | Initialized the goolog logger.

But in reality, the log message will be formatted with color like this:

GREY | GREY | WHITE | * | WHITE

*:
    DEBUG -> Blue
    ERROR -> Red
    INFO  -> Green
    TRACE -> White
    WARN  -> Yellow