Closed georgkrause closed 5 years ago
@georgkrause, can you post an example of how it is done currently and one of how you think it would be better?
Well, there are some commented printfs in some files which seems to be there to output some debug information.
would be nice to do something like
if(DEBUG) printf ...
There is also debug.hxx/cxx
which defines functions to log debug output. Shouldn’t these be used?
Except from debug.hxx
:
#define LUPPP_NOTE( format, args... ) luppp_debug( DEBUG_LEVEL_NOTE, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
#define LUPPP_WARN( format, args... ) luppp_debug( DEBUG_LEVEL_WARN, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
#define LUPPP_ERROR( format, args... ) luppp_debug( DEBUG_LEVEL_ERROR, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
@coderkun you are right, there are some prebuild functions for debugging but i dont know how they fit together at the moment.
I would also like to know how to set the log level to get the actual log messages ;)
The Ctlra code has a better (runtime capable) logging mechanism. It could be ported to Luppp relatively easily I think.
Is there any documentation how it works or could you point us to the implementation?
Code is documentation, Ctlra code available here https://github.com/openAVproductions/openAV-Ctlra/blob/master/ctlra/impl.h#L46
There's probably some improvements that can be made there, but it works well enough
There are a lot of //printf(...);
which need to be replaced. Porting the Ctlra-Stuff seems to be a good idea. Could be a part of a major refactoring. I will keep this in mind.
Well, in general it looks like a pretty good idea to port the logging mechanism of Ctlra to Luppp. But for my current cleanup I am going to use the method used in Luppp:
#define DEBUG_SOMETHING 1
#ifdef DEBUG_SOMETHING
printf(...)
#endif
The reason is that I want at first focus on clean class interfaces and good and consistent naming of vars and fixing obvious problems in code. After this is done, it should be quite easy to change the debug outputs.
At the moment i am looking at all files to remove functions which are commented out at the moment because they are not needed anymore. However, i found a lot of comments which seem to be there for debugging. Wouldnt it be better to define a "debug mode" which one could set before compiling which would activate all this debug outputs? Seems to be a lot easier and cleaner.