Crates.io | logfast |
lib.rs | logfast |
version | 1.1.8 |
source | src |
created_at | 2020-01-11 00:43:10.032774 |
updated_at | 2022-07-16 07:29:36.460384 |
description | Insanely fast logging with a simple interface |
homepage | https://crates.io/crates/logfast |
repository | https://github.com/alfiedotwtf/logfast |
max_upload_size | |
id | 197379 |
size | 6,847 |
logfast - Insanely fast logging with a simple interface
use logfast::LogFast;
fn main() {
let buffer_size = 100;
let mut lf = LogFast::new("my.log", buffer_size).unwrap();
lf.log("Here's a test log line");
lf.log("And here's another");
}
$ cat my.log
2020-01-10 23:54:25.177300600: Here's a test log line
2020-01-10 23:54:25.177380200: And here's another
When you're doing things at speed, synchronous logging can really get in the
way. Normally, each time you write to your logfile, your main thread will block
until the write happens (this can be SLOW). Not with LogFast
. Each time you
call log()
, it:
Meanwhile, in the LogFast
thread, it will flush the logs to the file as fast
as it can, and then go back to sleep until new log messages arrive. This
effectively parallelises the log writing with your main thread. Neat!
Please report any bugs or feature requests at:
Feel free to fork the repository and submit pull requests :)
IT COMES WITHOUT WARRANTY OF ANY KIND.
Copyright (C) 2021 by Alfie John
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.