write_level = RMR_VL_DEBUG;
}
+ memset( msg, 0, sizeof( msg ) ); // logging is slow; this ensures 0 term if msg is too large
hlen = snprintf( msg, sizeof( msg ), "%ld %d/RMR [%s] ", (long) time( NULL ), log_pid, log_situations[write_level] );
+ if( hlen > sizeof( msg ) - 1024 ) { // should never happen, but be parinoid
+ return;
+ }
body = msg + hlen;
va_start( argp, fmt ); // suss out parm past fmt
vsnprintf( body, sizeof( msg ) - (hlen+2), fmt, argp ); // add in user message formatting it along the way
fprintf( stderr, "%s", msg ); // we grew from printfs so all existing msg have \n; assume there
+
+ va_end( argp );
}
/*
rmr_vlog_init();
}
- if( log_vlevel <= 0 ) { // cant force if off completely to allow for total silience
+ if( log_vlevel <= 0 ) { // can force if off completely to allow for total silience
return;
}
vsnprintf( body, sizeof( msg ) - (hlen+2), fmt, argp ); // add in user message formatting it along the way
fprintf( stderr, "%s", msg ); // we grew from printfs so all existing msg have \n; assume there
+
+ va_end( argp );
}
// -------------------- public functions that are needed -----------------