Esempio n. 1
0
void SystemLog::postLog(LogSeverity::Severity severity, const char* format, ...)
{
	va_list argList;
	va_start(argList, format);
	QString message = QString().vsprintf(format, argList);
	postLog(message, severity);
	va_end(argList);
}
Esempio n. 2
0
void CSystemLog::postLog(LogSeverity::Severity severity, Components::Component component,
						 const char* format, ...)
{
	va_list argList;
	va_start( argList, format );
	QString message = QString().vsprintf( format, argList );
	postLog( severity, component, message );
	va_end( argList );
}
Esempio n. 3
0
void CSystemLog::postLog(LogSeverity::Severity severity, Components::Component component,
						 QString message)
{
	static LogSeverity::Severity lastSeverity  = LogSeverity::Information;
	static Components::Component lastComponent = Components::None;
	static QString lastMessage;
	static int suppressed = 0;
	static bool bCheck = true;

	if ( bCheck )
	{
		if ( severity == lastSeverity && component == lastComponent && message == lastMessage )
		{
			++suppressed;
			return;
		}
		else
		{
			if ( suppressed > 0 )
			{
				bCheck = false;
				postLog( lastSeverity, lastComponent,
						 tr( "Suppressed %n identical message(s).", 0, suppressed ) );
				bCheck = true;
			}
			lastMessage   = message;
			lastSeverity  = severity;
			lastComponent = component;
			suppressed = 0;
		}
	}

	message = msgFromComponent( component ) + message;

	switch ( severity )
	{
		case LogSeverity::Debug:
		case LogSeverity::Warning:
		case LogSeverity::Critical:
		case LogSeverity::Error:
			qCritical() << qPrintable(message);
			break;
		default:
			break;
	}

	emit logPosted( message, severity );
}
Esempio n. 4
0
void CSystemLog::postLog(LogSeverity::Severity severity, QString message)
{
	postLog( severity, Components::None, message );
}