#log #logger #logging #thread

file-per-thread-logger

A logging implementation that writes logs in one file per thread

7 releases

0.1.6 Jan 5, 2023
0.1.5 Feb 5, 2022
0.1.4 Aug 20, 2020
0.1.3 May 14, 2020
0.1.0 Jul 30, 2018

#56 in Debugging

Download history 22478/week @ 2022-11-28 21797/week @ 2022-12-05 20972/week @ 2022-12-12 19987/week @ 2022-12-19 11031/week @ 2022-12-26 19534/week @ 2023-01-02 22996/week @ 2023-01-09 25549/week @ 2023-01-16 24523/week @ 2023-01-23 23114/week @ 2023-01-30 23782/week @ 2023-02-06 27268/week @ 2023-02-13 26199/week @ 2023-02-20 29894/week @ 2023-02-27 29078/week @ 2023-03-06 26432/week @ 2023-03-13

113,297 downloads per month
Used in 98 crates (2 directly)

Apache-2.0 WITH LLVM-exception

10KB
108 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

~1–1.5MB
~42K SLoC