Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhangyuang/timelog
implement console.time api interface in Rust
https://github.com/zhangyuang/timelog
rust rust-log timelog
Last synced: 16 days ago
JSON representation
implement console.time api interface in Rust
- Host: GitHub
- URL: https://github.com/zhangyuang/timelog
- Owner: zhangyuang
- Created: 2024-10-17T14:34:10.000Z (28 days ago)
- Default Branch: main
- Last Pushed: 2024-10-19T11:03:06.000Z (26 days ago)
- Last Synced: 2024-10-19T14:24:05.871Z (26 days ago)
- Topics: rust, rust-log, timelog
- Language: Rust
- Homepage: https://docs.rs/timelog
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# timelog
A simple timer library for logging time durations, similar to console.time in JavaScript.
## Features
- Create multiple named timers
- Start, log, and end timers
- Print timing results in milliseconds
- Support for optional additional messages## Installation
Add the following line to your `Cargo.toml` file:
```toml
[dependencies]
timelog = "1.0.0"
```## Usage
```rust
use timelog::Timer;fn main() {
let mut timer = Timer::new();timer.time("fetch_data");
let duration: f64 = timer.time_log("fetch_data", true);
println!("fetch_data took {:.2}ms", duration);
}
```## Documentation
[timelog](https://docs.rs/timelog)