| Crates.io | logt |
| lib.rs | logt |
| version | 0.1.1 |
| created_at | 2025-03-09 20:43:47.374149+00 |
| updated_at | 2025-03-09 21:40:32.709552+00 |
| description | CLI wrapper that provides timestamps to output lines |
| homepage | |
| repository | https://codeberg.org/Joz/logt |
| max_upload_size | |
| id | 1585837 |
| size | 26,525 |
Measuring the execution time of a longer running command is perfectly solved by the builtin time that most shells provide. But in case you wanted to measure the individual steps a command takes, you might want to log the time of each outputted line. That's what logt is for.
logt executes a wrapped CLI command and annotates each output line with a timestamp like this:
|
Original command |
Wrapped command |
|
|
Execute cargo install logt.
logt [FLAGS] [--] PROGRAM [ARGS]
| Flag | Meaning |
|---|---|
| -r | Instead of the absolute time, show the duration since the start of the program. |
| -s | For each line, show if it was emitted on stderr or stdout. |
| -h | Show a more detailed help. |
The -- flag can be used to mark the end of logt flags. This would be useful in the unfortunate case that your program path or name starts with a hyphen, to distinguish it from a CLI option.
PROGRAM can be a path (absolute/relative) to an executable or just a file name, if the executable is installed in one of the directories in the PATH variable.
$ logt -rs ./test.sh
[stdout +0.000873863s] Message 1
[stderr +0.000909503s] Message 2
[stdout +0.000918523s] Message 3
[stderr +0.000922283s] Message 4
logt is not a shell builtin, it can not directly execute bracket commands. time (a && b) would therefore very roughly translate to something like logt sh -c 'a && b'.