#tracing #init #logging #config #log #convenient #format

clia-tracing-config

A convenient tracing config and init lib, with symlinking and local timezone

8 releases

0.2.7 Jan 6, 2024
0.2.6 Dec 17, 2023
0.2.5 Oct 25, 2022
0.1.0 Sep 21, 2022

#162 in Debugging

Download history 23/week @ 2024-07-21 34/week @ 2024-07-28 26/week @ 2024-08-04 32/week @ 2024-08-11 49/week @ 2024-08-18 57/week @ 2024-08-25 49/week @ 2024-09-01 45/week @ 2024-09-08 35/week @ 2024-09-15 101/week @ 2024-09-22 43/week @ 2024-09-29 32/week @ 2024-10-06 47/week @ 2024-10-13 22/week @ 2024-10-20 16/week @ 2024-10-27 46/week @ 2024-11-03

134 downloads per month
Used in 6 crates

MIT license

13KB
226 lines

clia-tracing-config

A convenient tracing config and init lib, with symlinking and local timezone.

image

Use these formats default, and can be configured:

  • pretty()
  • with_level(true)
  • with_target(true)
  • with_thread_ids(true)
  • with_thread_names(true)
  • with_source_location(true)

Usage

Code example and default values:

let _guard = clia_tracing_config::build()
    .filter_level("info")
    .with_ansi(true)
    .to_stdout(false)
    .directory("./logs")
    .file_name("my-service.log")
    .rolling("daily")
    .init();

tracing::info!("logged by tracing");
log::info!("logged by tracing");

rolling supports:

  • minutely
  • hourly
  • daily
  • never

Changelog

  • 0.2.7: Fix json fmt error. (2024-1-6)
  • 0.2.6: Make pub use WorkerGuard. (2023-12-17)
  • 0.2.5: Fix timer problem (no effect). (2022-10-25)
  • 0.2.4: Fix to_stdout impl. (2022-10-22)
  • 0.2.3: Change clia-time to clia-local-offset. (2022-10-22)
  • 0.2.2: Make level support expr. (2022-10-22)
  • 0.2.1: Add Debug & Clone. (2022-10-11)
  • 0.2.0: Refacted impl. (2022-10-2)
  • 0.1.0: Initial release. (2022-9-21)

Dependencies

~6–8.5MB
~146K SLoC