[Openais] Logging patch.

Steven Dake scd at broked.org
Thu Oct 28 10:28:30 PDT 2004


Daniel

Separate functions for each log level seem like a good idea to me.  I'm
not sure how the stack is different for the changes you have made (was
it va_start/va_end that was causing the problem?), but the changes look
fine to me.

Could you fix a few things though?

1. ais_error should be ais_log_error.  Same for the other functions.

2. There must be a ais_log_security and ais_log_debug.

3. LOG_SERVICE should remain undefined and should cause a compile error
if it is undefined.  This happens now automatically but it could be
cleaner with something like this in the print.h header file:
#ifndef LOG_SERVICE
#error "you must define LOG_SERVICE in any source file that includes
print.h"
#endif

4. I do not like the compatibility functions.  Either we use one set of
functions or the other.  Hence, all the users should be changed to use
the new log functions.  Also the compatibility stuff should be removed.

Regards,
-steve

On Thu, 2004-10-28 at 05:04, Daniel Stodden wrote:
> hi.
> 
> this is a comparatively massive one, left for discussion:
> 
> ChangeSet at 1.96.1.1, 2004-10-28 12:24:18+02:00, dns at somacoma.net
> 
>   Changed logging interface, fixing a stack corruption bug with the
> varargs
>   usage in print.c
> 
>   main.c:
>     Started replacing calls to log_printf in main() with ais_log() calls
> for
>     demonstration/testing purposes.
>   print.h:
>     Replaced internal_log_printf() with two new functions: ais_log() and
> ais_logv().
>     Old functions are left for backwards compatibility.
>     Added macros ais_error/notice/warning/debug.
>     Define LOG_SERVICE to 0 if not defined in the including source file.
>   print.c:
>     Replaced internal_log_printf() with two new functions: ais_log() and
> ais_logv().
>     Old functions are left for backwards compatibility.
>     This has the side effect of fixing a severe stack corruption effect
> in nested
>     format string creation/applications I'm experiencing with
> internal_log_printf().
>     Functionality stays roughly the same. Unneeded packing of loglevel
> and service
>     in the basic functions is eliminated, though.
> 
> 
> regards,
> daniel




More information about the Openais mailing list