openAVproductions / openAV-Luppp

Luppp is a live performance tool, created by OpenAV productions.
http://openavproductions.com/luppp
GNU General Public License v3.0
258 stars 44 forks source link

Better Debugging Outputs #217

Closed georgkrause closed 5 years ago

georgkrause commented 6 years ago

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.

coderkun commented 6 years ago

@georgkrause, can you post an example of how it is done currently and one of how you think it would be better?

georgkrause commented 6 years ago

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 ...

coderkun commented 6 years ago

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 )
georgkrause commented 6 years ago

@coderkun you are right, there are some prebuild functions for debugging but i dont know how they fit together at the moment.

coderkun commented 6 years ago

I would also like to know how to set the log level to get the actual log messages ;)

harryhaaren commented 6 years ago

The Ctlra code has a better (runtime capable) logging mechanism. It could be ported to Luppp relatively easily I think.

georgkrause commented 6 years ago

Is there any documentation how it works or could you point us to the implementation?

harryhaaren commented 6 years ago

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

georgkrause commented 6 years ago

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.

georgkrause commented 6 years ago

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.