log4rs

A highly configurable logging framework for Rust

  • 所有者: estk/log4rs
  • 平台:
  • 許可證: Apache License 2.0
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

log4rs

docs
crates.io
License: MIT OR Apache-2.0
CI
Minimum rustc version

log4rs is a highly configurable logging framework modeled after Java's Logback
and log4j libraries.

Documentation

log4rs.yaml:

refresh_rate: 30 seconds
appenders:
  stdout:
    kind: console
  requests:
    kind: file
    path: "log/requests.log"
    encoder:
      pattern: "{d} - {m}{n}"
root:
  level: warn
  appenders:
    - stdout
loggers:
  app::backend::db:
    level: info
  app::requests:
    level: info
    appenders:
      - requests
    additive: false

lib.rs:

use log::{error, info, warn};
use log4rs;

fn main() {
    log4rs::init_file("config/log4rs.yaml", Default::default()).unwrap();

    info!("booting up");

    // ...
}

Rust Version Requirements

Since version 0.10.0 the minimum version for rust is 1.38.0 and is verified via CI.
1.38.0 is required for windows due to the backtrace crate.
1.34.0 may work for unix environments although it is not officially supported.

Building for Dev

  • Run the tests: cargo test --all-features
  • Run the tests for windows with cross: cross test --target x86_64-pc-windows-gn
  • Run the tests for all individual features: ./test.sh
  • Run the tests for all individual features for windows with cross: ./test.sh win

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you shall be dual licensed as above, without any
additional terms or conditions.

主要指標

概覽
名稱與所有者estk/log4rs
主編程語言Rust
編程語言Rust (語言數: 2)
平台
許可證Apache License 2.0
所有者活动
創建於2015-01-27 17:09:19
推送於2025-06-27 17:04:56
最后一次提交
發布數42
最新版本名稱v1.4.0-rc2 (發布於 )
第一版名稱v0.1.0 (發布於 )
用户参与
星數1.1k
關注者數12
派生數161
提交數547
已啟用問題?
問題數240
打開的問題數34
拉請求數120
打開的拉請求數14
關閉的拉請求數52
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?