logpeek

Crates.iologpeek
lib.rslogpeek
version0.2.1
sourcesrc
created_at2024-03-05 15:02:01.239417
updated_at2024-05-02 18:24:03.616679
descriptionA logger implementation for the log crate. Meant to integrate with logpeek-server.
homepage
repositoryhttps://github.com/TheHighestBit/logpeek
max_upload_size
id1163149
size33,321
Joosep Orasmäe (TheHighestBit)

documentation

README

logpeek

logpeek is a logger implementation for the log crate, which focuses on reliability and simplicity. It is meant to integrate seamlessly with logpeek-server.

  • Remote monitoring with logpeek-server. Logpeek is designed to work with logpeek-server by default, a web-based log tail explorer.

  • A drop-in replacement for existing logger implementations. If already using the log crate and it's macros, simply replace your existing logger with logpeek and you're good to go.

  • Ease of use. The logger is configured via a Config struct, although for most use cases, the default configuration will suffice.

Usage

Use cargo add logpeek log or include them in your Cargo.toml.

Initializing the logger is as simple as

use logpeek;
use log::error;

fn main() {
    // See the documentation for the config module for more options
    let config = logpeek::config::Config {
        logging_mode: logpeek::config::LoggingMode::FileAndConsole,
        datetime_format: logpeek::config::DateTimeFormat::Custom("[hour]:[minute]:[second]:[subsecond][offset_hour sign:mandatory]"), // Logpeek-server requires the UTC offset to be present. 
        ..Default::default()
    };

    logpeek::init(config).unwrap(); // For the default config use logpeek::init(Default::default()).unwrap();

    error!("This is a test error!");   
}
Commit count: 34

cargo fmt