[][src]Macro stackdriver_logger_kv::init_with_cargo

macro_rules! init_with_cargo {
    ($e:expr) => { ... };
    () => { ... };
}

Initialize the logger using your project's TOML file.

This initializer includes your Cargo.toml file at compile time and extract the service name and version at run time.

Usage

This is the basic form :

use log::info;

fn main() {
    stackdriver_logger::init_with_cargo!();
    info!("Default path used for Cargo.toml : ../Cargo.toml");
}

You can also specify the path if you need to :

use log::info;

fn main() {
    stackdriver_logger::init_with_cargo!("../Cargo.toml");
    info!("Path was specified !");
}

Note that the init_with_cargo! macro will include your Cargo.toml in the resulting binary. If you don't want that, take a look at the other initializers.