#per-thread #logging #thread #log #logger #log-file

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

#143 in Concurrency

Download history 37110/week @ 2024-01-09 44001/week @ 2024-01-16 38704/week @ 2024-01-23 38523/week @ 2024-01-30 44814/week @ 2024-02-06 44551/week @ 2024-02-13 47647/week @ 2024-02-20 46183/week @ 2024-02-27 40544/week @ 2024-03-05 42952/week @ 2024-03-12 44105/week @ 2024-03-19 37616/week @ 2024-03-26 53141/week @ 2024-04-02 54858/week @ 2024-04-09 43806/week @ 2024-04-16 37505/week @ 2024-04-23

197,190 downloads per month
Used in 158 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

~3–4.5MB
~71K SLoC