Logging best practices #231
|
Do you have some best practices for logging? It can happen all the time that for example a QDMI device encounters an error. Sometimes fatal ones. QDMI has a very low level interface were by default (if nobody implementes a more elaborate solution) you only see that e.g. a fatal error occured (enum An abstract example could be the following: Your device depends on some environment variable being set. E.g. I can of course always use |
Replies: 4 comments 5 replies
|
@burgholzer @ystade @echavarria-lrz any oppinions feedback on that 🙏 . |
|
Logging can indeed be rather helpful during development. There is no dedicated policy on what a device may or may not print to std::cout or std::cerr. So, at the moment, a device is free to make use of these streams extensively. One thing that @ystade and I have been talking about briefly was to add a device-level property |
|
Thanks for you feedback. OK then in the short term I will just log whatever I think is useful. In the long run I know that something is under discussion. |
|
Should I leave the discussion open for possible future conversations or should I just mark it as answered? |
Logging can indeed be rather helpful during development.
The current solutions that we have employed mostly involve using a hand-rolled logging library or to make use of one of the existing C++ logging libraries out there, like spdlog.
The difference between production and development would typically just be the logging level.
There is no dedicated policy on what a device may or may not print to std::cout or std::cerr. So, at the moment, a device is free to make use of these streams extensively.
One thing that @ystade and I have been talking about briefly was to add a device-level property
LASTERRORMSGthat can be used to programmatically query (from the user side) as well as report (from…