improve zms logging

This commit is contained in:
Isaac Connor 2017-11-21 23:55:53 -05:00
parent e617ffca2d
commit 752990bb0f
1 changed files with 12 additions and 6 deletions

View File

@ -84,12 +84,6 @@ int main( int argc, const char *argv[] ) {
zmLoadConfig();
logInit( "zms" );
hwcaps_detect();
zmSetDefaultTermHandler();
zmSetDefaultDieHandler();
const char *query = getenv( "QUERY_STRING" );
if ( query ) {
@ -175,6 +169,14 @@ int main( int argc, const char *argv[] ) {
} // end foreach parm
} // end if query
char log_id_string[32] = "zms";
if ( monitor_id ) {
snprintf(log_id_string, sizeof(log_id_string), "zms_m%d", monitor_id);
} else {
snprintf(log_id_string, sizeof(log_id_string), "zms_e%d", event_id);
}
logInit( log_id_string );
if ( config.opt_use_auth ) {
User *user = 0;
@ -205,6 +207,10 @@ int main( int argc, const char *argv[] ) {
ValidateAccess( user, monitor_id );
}
hwcaps_detect();
zmSetDefaultTermHandler();
zmSetDefaultDieHandler();
setbuf( stdout, 0 );
if ( nph ) {
fprintf( stdout, "HTTP/1.0 200 OK\r\n" );