While debug feature is helpful for debugging, there left some boring jobs like:
use erg_common::color::*;
log!("{GREEN}[DEBUG] msg {RESET}");
Currently, debug outputs look like:
Once we forget to end with "msg {RESET}", output are painted in all green and it is a little bit difficult to see.
Also, handwritten [DEBUG] is not aligned due to different length of file/line info.
Thus, I introduced these fix in log! macro
Changes proposed in this PR:
Inserting [DEBUG] in front of file/line information to log in default.
Forcing color reset for every log!
Adding directives in log! to switch colors we like.
Shorthand for green output(info) and red output(err)(for debugging, maybe warn is not necessary)
(- documentation for log! directives above)
With these utilities, we can easily write neat logs with:
While
debug
feature is helpful for debugging, there left some boring jobs like:Currently, debug outputs look like:
Once we forget to end with
"msg {RESET}"
, output are painted in all green and it is a little bit difficult to see. Also, handwritten[DEBUG]
is not aligned due to different length of file/line info.Thus, I introduced these fix in
log!
macro Changes proposed in this PR:[DEBUG]
in front of file/line information to log in default.log!
log!
to switch colors we like.info
) and red output(err
)(for debugging, maybe warn is not necessary) (- documentation forlog!
directives above)With these utilities, we can easily write neat logs with:
and outputs look like:
@mtshiba