Open oroulet opened 10 years ago
If there debug logs enables for all application then I don't like it. There should be ability to enable/disable debug (increase decrease level) logs for specific part of application. In another case amount of logs will be huge. For example we can enable logging for address space but disable protocol logging.. I like standard streams - it is simple, well known, works well on linux and even on windows (aeleast cout & cerr) and it doesn't require additional libraries. One thing is bad - localization. there isn't possible to use for example gettext.
Second thing - runtime overhead. construction: if (Debug) std::cout << "debug"; Almost hasn't overhead. but something like this: Debug("Message size %s", toint(Header.Size)) Will require at least converting in to string. This example: L(debug) << "Message size" << header.Size; Will compute operators '<<' .
Moreover I thing that debug logs shouln't be localized. Localization should touch only public messages, for example text of errors and some informational messages.
On Aug 8, 2014 11:02 PM, "Alexander Rykovanov" notifications@github.com wrote:
If there debug logs enables for all application then I don't like it. There should be ability to enable/disable debug (increase decrease level) logs for specific part of application.
I agree this is the minimum to expect. The frameworks I know do it ..... I need to check boost::log
Second thing - runtime overhead. Now construction: if (Debug) std::cout << "debug"; Almost hasn't overhead. but something like this Debug("Message size %s", to_int(Header.Size)) Will require at least converting in to string.
This example: L_(debug) << "Message size" << header.Size; Will compute operators '<<' .
You are right but I expect the boost people will have thought about it and have solutions
Moreover I thing that debug logs shouln't be localized.
Agree. I even think protocol libraries like freeopcua should not care about localizing... apart from opcua part
https://github.com/easylogging/easyloggingpp
might be a nice solution. we just copy header in our source code without external dependencies
Using looks good, but size of header.... :(
2014-11-16 18:18 GMT+03:00 oroulet notifications@github.com:
https://github.com/easylogging/easyloggingpp
might be a nice solution. we just copy header in our source code without external dependencies
— Reply to this email directly or view it on GitHub https://github.com/FreeOpcUa/freeopcua/issues/22#issuecomment-63222564.
Best regards, Alexander Rykovanov.
if (Debug) std::cout << "debug"; Almost hasn't overhead. but something like this: Debug("Message size %s", toint(Header.Size)) Will require at least converting in to string. This example: L(debug) << "Message size" << header.Size; Will compute operators '<<' .
Seems like the common solution to this is
That way we benefit from a logging framework and do not have more performance penality. I do not know if some logging framework already do this out-of-the-box...
Here is another option too, claims that it is very fast: https://github.com/gabime/spdlog
We badly need a logging framework to clean up and give logging control to the users. I see that boost just integrated a logging framework in 1_54. Can we use it?
simple example here: http://torjo.com/log2/doc/html/scenarios_code.html#scenarios_code_mom
But I am missing the possibility to have a logger per call or module,, log4j and the default c#/python logger all have methods that automatically format the output using the class name, I could not find the functionnality in boost logging .....