log/m_log_tcp_syslog.c
/* TODO: replace this with improved datestring formatting from M_time, once we get around to implementing it. */
replace this with improved datestring formatting from M_time, once we get around to implementing it.
replace this with improved datestring formatting from M_time once we get around to implementing it .
static void add_syslog_header(M_buf_t *buf, module_thunk_t *mdata, M_syslog_priority_t priority)
{
	M_time_localtm_t     now;
	const char          *month_str = "";
	if (buf == NULL || mdata == NULL) {
		return;
	}
	M_time_tolocal(M_time(), &now, NULL);
	switch (now.month) {
		case 1:  month_str = "Jan"; break;
		case 2:  month_str = "Feb"; break;
		case 3:  month_str = "Mar"; break;
		case 4:  month_str = "Apr"; break;
		case 5:  month_str = "May"; break;
		case 6:  month_str = "Jun"; break;
		case 7:  month_str = "Jul"; break;
		case 8:  month_str = "Aug"; break;
		case 9:  month_str = "Sep"; break;
		case 10: month_str = "Oct"; break;
		case 11: month_str = "Nov"; break;
		case 12: month_str = "Dec"; break;
	}
	M_bprintf(buf, "<%d>%s %2lld %02lld:%02lld:%02lld %s %.32s: ", (int)((int)mdata->facility | (int)priority), month_str,
		now.day, now.hour, now.min, now.sec, mdata->src_host, mdata->product);
}
static void add_syslog_header ( M_buf_t * buf , module_thunk_t * mdata , M_syslog_priority_t priority ) { M_time_localtm_t now ; const char * month_str = " " ; if ( buf == NULL || mdata == NULL ) { return ; } M_time_tolocal ( M_time ( ) , & now , NULL ) ; switch ( now . month ) { case 1 : month_str = " " ; break ; case 2 : month_str = " " ; break ; case 3 : month_str = " " ; break ; case 4 : month_str = " " ; break ; case 5 : month_str = " " ; break ; case 6 : month_str = " " ; break ; case 7 : month_str = " " ; break ; case 8 : month_str = " " ; break ; case 9 : month_str = " " ; break ; case 10 : month_str = " " ; break ; case 11 : month_str = " " ; break ; case 12 : month_str = " " ; break ; } M_bprintf ( buf , " " , ( int ) ( ( int ) mdata -> facility | ( int ) priority ) , month_str , now . day , now . hour , now . min , now . sec , mdata -> src_host , mdata -> product ) ; }
TODO: replace this with improved datestring formatting from M_time, once we get around to implementing it.
TODO : replace this with improved datestring formatting from M_time once we get around to implementing it .
/* NOTE: must not contain any tabs or newline chars */ /* WARNING: the formatting here is very strict, in accordance with RFC 3164, pages 7-10. Don't change it. */