4 ms·
> No logging library. This one was pretty easy. Create a little class with logging levels. Do you print to /dev/stdlog using the correct syslog format or use j
by bombolo 4y ago
> No logging library. This one was pretty easy. Create a little class with logging levels.
Do you print to /dev/stdlog using the correct syslog format or use journald and its format?
Because if it's not one of those, the "levels" are useless.
- bornfreddy 4y agoNo, the levels are not useless, far from it. Even if you just print to stdout, prefixing each line with a (maybe colored?) level info is very useful. Also, if later you decide to use xyz format, it is trivial to implement this. Changing all logging calls? Not so much.
- bombolo 4y agoJust use a real logging daemon and it will be the colours by itself. It will also let you query for which level you want. > Changing all logging calls? Not so much. Uh? Make a good library using the same interface.
- lightswitch05 4y agoTo answer your question, the levels are important for both regular usage and debugging when something goes wrong. I create a number of debug/info/warning/error log messages throughout the tool and allow the desired level of logging to be set as a CLI argument - or even run in silent mode if desired.