コード例 #1
0
ファイル: log.c プロジェクト: jokva/ert
/**
   If dup_stream != NULL the message (without the date/time header) is duplicated on this stream.
*/
void log_add_message(log_type *logh, int message_level , FILE * dup_stream , char* message, bool free_message) {
    if (log_include_message(logh,message_level)) {

        if (logh->stream == NULL)
            util_abort("%s: logh->stream == NULL - must call log_reset_filename() first \n",__func__);

#ifdef HAVE_PTHREAD
        pthread_mutex_lock( &logh->mutex );
#endif
        {
            struct tm time_fields;
            time_t    epoch_time;

            time(&epoch_time);
            util_localtime(&epoch_time , &time_fields);

            if (message != NULL)
                fprintf(logh->stream,"%02d/%02d - %02d:%02d:%02d  %s\n",time_fields.tm_mday, time_fields.tm_mon + 1, time_fields.tm_hour , time_fields.tm_min , time_fields.tm_sec , message);
            else
                fprintf(logh->stream,"%02d/%02d - %02d:%02d:%02d   \n",time_fields.tm_mday, time_fields.tm_mon + 1, time_fields.tm_hour , time_fields.tm_min , time_fields.tm_sec);

            /** We duplicate the message to the stream 'dup_stream'. */
            if ((dup_stream != NULL) && (message != NULL))
                fprintf(dup_stream , "%s\n", message);

            log_sync( logh );
        }
#ifdef HAVE_PTHREAD
        pthread_mutex_unlock( &logh->mutex );
#endif
        if (free_message)
            free( message );
    }
}
コード例 #2
0
int fimc_is_logsync(struct fimc_is_interface *itf, u32 sync_id, u32 msg_test_id)
{
	int ret = 0;

	/* print kernel sync log */
	log_sync(sync_id);

#ifdef ENABLE_FW_SYNC_LOG
	ret = fimc_is_hw_msg_test(itf, sync_id, msg_test_id);
	if (ret)
	err("fimc_is_hw_msg_test(%d)", ret);
#endif
	return ret;
}