3 个不稳定版本
| 0.2.1 | 2024 年 5 月 2 日 | 
|---|---|
| 0.2.0 | 2024 年 5 月 2 日 | 
| 0.1.0 | 2024 年 3 月 5 日 | 
#294 在 调试
每月 41 次下载
26KB
441 行
logpeek
logpeek 是 log crate 的日志实现,它注重可靠性和简洁性。它旨在与 logpeek-server 无缝集成。
- 
与 logpeek-server 的远程监控。 Logpeek 默认设计为与基于 Web 的日志尾部浏览器 logpeek-server 配合使用。 
- 
现有日志实现的直接替换。 如果已经使用 logcrate 和它的宏,只需用logpeek替换现有的日志即可。
- 
易于使用。 日志配置通过 Config结构体进行,尽管对于大多数用例,默认配置就足够了。
使用方法
使用 cargo add logpeek log 或在 Cargo.toml 中包含它们。
初始化日志器就像这样简单
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!");   
}
依赖项
~0.8–10MB
~57K SLoC