[][src]Crate mhlog

A tiny, simple, thread-safe logging library. No configuration options, take it or leave it.

Writes log messages to stdout/stderr. The writes are thread-safe. If an error occurs when writing to the log file it panics.

Provided logging macros:

Usage

extern crate mhlog;

use mhlog::{log,info,warn,err};

log!("Log message. Prefixed with a timestamp. It's {}", "thread-safe!");
info!("Logging message prefixed by '<timestamp> Info:' ");
warn!("Warning message prefixed by '<timestamp> Warning:' ");
err!("Error message prefixed by '<timestamp> Error:' ");

Features

Writing to stdout

By default all log messages are printed to stderr. To make log!() and info!() print to stdout instead, enable the log2stdout feature.

[dependencies]
mhlog = { version = "*", features = ["log2stdout"] }

Coloured log messages

Coloured log messages can be enabled with the colours feature.

[dependencies]
mhlog = { version = "*", features = ["colours"] }

Macros

err

Print an error log message, prefixed by a timestamp and Error.

info

Print an info log message, prefixed by a timestamp and Info.

log

Print a log message, prefixed by a timestamp.

warn

Print a warning log message, prefixed by a timestamp and Warning.