public void UpdateStatus(Guid client, UpdateType type, bool publishToLog, string message, params object[] args)
{
string formattedMessage = string.Format(message, args);
if (publishToLog)
{
switch (type)
{
case UpdateType.Information:
s_logStatusInfo.Publish(formattedMessage, client.ToString());
break;
case UpdateType.Warning:
s_logStatusWarning.Publish(formattedMessage, client.ToString());
break;
case UpdateType.Alarm:
s_logStatusAlarm.Publish(formattedMessage, client.ToString());
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
const int HighPriority = 2;
const int LowPriority = 1;
StatusUpdate update;
if (m_suppressUpdates)
return;
update = new StatusUpdate(client, type, formattedMessage);
if (client != Guid.Empty)
m_statusUpdateThread.Push(HighPriority, () => PrioritizeStatusUpdate(update));
else
m_statusUpdateThread.Push(LowPriority, () => QueueStatusUpdate(update));
}