file-per-thread-logger

A logging implementation that writes logs in one file per thread

8 releases

0.2.0 Jun 2, 2023
0.1.6 Jan 5, 2023
0.1.5 Feb 5, 2022
0.1.4 Aug 20, 2020
0.1.0 Jul 30, 2018

#268 in Date and time

Download history 46545/week @ 2024-06-15 52955/week @ 2024-06-22 43392/week @ 2024-06-29 43734/week @ 2024-07-06 56867/week @ 2024-07-13 61364/week @ 2024-07-20 56196/week @ 2024-07-27 57017/week @ 2024-08-03 73621/week @ 2024-08-10 56042/week @ 2024-08-17 61698/week @ 2024-08-24 66686/week @ 2024-08-31 64005/week @ 2024-09-07 60838/week @ 2024-09-14 61826/week @ 2024-09-21 50958/week @ 2024-09-28

249,016 downloads per month
Used in 178 crates (via wasmtime-cli-flags)

Apache-2.0 WITH LLVM-exception

11KB
124 lines

File per thread logger

This is a thread-safe logger that will write logs to files, each thread owning its own file.

Usage

Put this in your Cargo.toml:

[dependencies]
file-per-thread-logger = "0.1.2"

Then add this to your code, once per thread:

file_per_thread_logger::initialize("file_prefix-");

Then each use of log's primitive will log into files named the following way:

  • the main thread get a file that's suffixed after the program's name.
  • unnamed threads get a file suffixed with ThreadIdN where N is the thread's id number.
  • named threads get a file suffixed with the thread's name.

Dependencies

~2.9–4MB
~71K SLoC