Drakulix / simplelog.rs

Simple Logging Facility for Rust
https://docs.rs/simplelog/
Apache License 2.0
439 stars 73 forks source link

Ability to pad level in logging output? #35

Closed johndrinkwater closed 5 years ago

johndrinkwater commented 5 years ago

It would be great if https://github.com/Drakulix/simplelog.rs/blob/master/src/loggers/logging.rs#L56 were able to use a custom formatting string to align or pad the level so that ERROR & INFO etc would neatly align the first character of their messages, for skimming over a large amount of output…

Luckily the log crate supports this already by using fmt.pad in the right place https://github.com/rust-lang-nursery/log/blob/master/src/lib.rs#L488

16:43:30 [INFO] stalling ‘Batch 00334’ < Stalled(3, 66) 2019-05-10T17:22:15Z >
16:43:30 [DEBUG] finished process queue.
16:43:30 [INFO] queueing state for next time

vs {: >5}

16:43:30 [ INFO] stalling ‘Batch 00334’ < Stalled(3, 66) 2019-05-10T17:22:15Z >
16:43:30 [DEBUG] finished process queue.
16:43:30 [ INFO] queueing state for next time
Drakulix commented 5 years ago

You are absolutely right. Would you like to submit a PR for this? Done.