Crate powerpack_logger

Source
Expand description

A simple file logger for use in Alfred workflows.

The logger comes preconfigured with sensible defaults for use in Alfred workflows.

§Usage

This crate is re-exported from the powerpack crate, so you can access it using powerpack::logger.

Using all the defaults. The following will write to a file at

{alfred_workflow_cache}/powerpack.log

And the log level will be set to Debug if the workflow is running in debug mode, otherwise it will be set to Info.

use powerpack::logger;

logger::Builder::new().init();

Logger::builder() returns a builder where you can further configure the logger. For example to set the filename and the log level.

use powerpack::logger;

const FILENAME: &str = concat!(env!("CARGO_PKG_NAME"), "-", env!("CARGO_PKG_VERSION"), ".log");
logger::Builder::new()
    .filename(FILENAME)
    .max_level(logger::LevelFilter::Warn)
    .init();

Structs§

Builder
A builder for configuring the file logger.
Logger
A simple logger that writes log messages to a file.

Enums§

Error
An error that can occur when using the logger.
LevelFilter
An enum representing the available verbosity level filters of the logger.