logging with osip
As I posted before, logging is an important debugging means. In order to be truly useful and convenient, the logging module should at lease have two traits:
There is a tiny bug which prevents us using the function pointer mechanism on windows platform if we compile the osip as dynamic library. The author forgot export osip_trace_initialize_func in osipparser2.def file. So our application will end in unresolved external symbol error if we use this function. To get around this, I added the line at the very end of osipparser2.def:
To use osip logging, we need to:
An example of is available here:
http://code.google.com/p/rxwen-blog-stuff/source/browse/trunk/protocol/osip_logging/osip_log.cpp
- can be turned on and off globally
- supports the concept of logging level
There is a tiny bug which prevents us using the function pointer mechanism on windows platform if we compile the osip as dynamic library. The author forgot export osip_trace_initialize_func in osipparser2.def file. So our application will end in unresolved external symbol error if we use this function. To get around this, I added the line at the very end of osipparser2.def:
osip_trace_initialize_func @416
To use osip logging, we need to:
- Compile osip with ENABLE_TRACE macro defined
- Define ENABLE_TRACE in our application
- Initialize osip logging module
- Write log message with: OSIP_TRACE (osip_trace(__FILE__, __LINE__, OSIP_INFO1, NULL, "log message"));
An example of is available here:
http://code.google.com/p/rxwen-blog-stuff/source/browse/trunk/protocol/osip_logging/osip_log.cpp