mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
prepare for publish sub crate scopetime
This commit is contained in:
parent
3d0926d279
commit
07aa0d603f
3 changed files with 20 additions and 0 deletions
|
|
@ -3,6 +3,9 @@ name = "scopetime"
|
|||
version = "0.1.0"
|
||||
authors = ["Stephan Dilly <dilly.stephan@gmail.com>"]
|
||||
edition = "2018"
|
||||
description = "log runtime of arbitrary scope"
|
||||
homepage = "https://gitui.org"
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
|
|
|
|||
16
scopetime/README.md
Normal file
16
scopetime/README.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# scopetime
|
||||
|
||||
*log runtime of arbitrary scope*
|
||||
|
||||
This crate is part of the [gitui](http://gitui.org) project and can be used to annotate arbitrary scopes to `trace` their execution times via `log`:
|
||||
|
||||
```rust
|
||||
fn foo(){
|
||||
scope_time!("foo");
|
||||
}
|
||||
```
|
||||
|
||||
the resulting log looks someting like this:
|
||||
```
|
||||
19:45:00 [TRACE] (7) scopetime: [scopetime/src/lib.rs:34] scopetime: 2 ms [my_crate::foo] @my_crate/src/bar.rs:5
|
||||
```
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
#[deny(unsafe_code)]
|
||||
use log::trace;
|
||||
use std::time::Instant;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue