/// <summary> /// Use this method to log an event to the distributed Ocean system. This method is thread-safe and waits /// until the answer comes in. /// </summary> /// <param name="senderName">Who is the sender? Which sub-component e.g. class, etc.</param> /// <param name="category">The logging category</param> /// <param name="level">The logging level</param> /// <param name="severity">The logging severity</param> /// <param name="impact">The logging impact</param> /// <param name="messageName">The logging message name</param> /// <param name="messageDescription">The description</param> /// <param name="parameters">Any count of additional parameters</param> /// <returns>True if the ICCC message with the logging event was successful, hence, the log event is processed.</returns> public bool logFullWait4Answer(string senderName, LogCategory category, LogLevel level, LogSeverity severity, LogImpact impact, LogMessageName messageName, string messageDescription, params string[] parameters) { var log = new ICCCNewLogEvent(); log.Sender = senderName; log.UnixTimestampUTC = DateTime.UtcNow.convert2UnixTimestamp(); log.Level = level.ToString(); log.Category = category.ToString(); log.Severity = severity.ToString(); log.Impact = impact.ToString(); log.MessageName = messageName.ToString(); log.MessageDescription = messageDescription; var answer = ICCCConnection.INSTANCE.send2Any(log, ICCCKind.KindOcean) as ICCCDefaultAnswer; return answer == null ? false : answer.CommandSuccessful; }
/// <summary> /// Use this method to log an event to the distributed Ocean system. This method is thread-safe! /// The method call will not block, thus, not wait and read the answer. /// </summary> /// <param name="senderName">Who is the sender? Which sub-component e.g. class, etc.</param> /// <param name="category">The logging category</param> /// <param name="level">The logging level</param> /// <param name="severity">The logging severity</param> /// <param name="impact">The logging impact</param> /// <param name="messageName">The logging message name</param> /// <param name="messageDescription">The description</param> /// <param name="parameters">Any count of additional parameters</param> public void logFull(string senderName, LogCategory category, LogLevel level, LogSeverity severity, LogImpact impact, LogMessageName messageName, string messageDescription, params string[] parameters) { var log = new ICCCNewLogEvent(); log.Sender = senderName; log.UnixTimestampUTC = DateTime.UtcNow.convert2UnixTimestamp(); log.Level = level.ToString(); log.Category = category.ToString(); log.Severity = severity.ToString(); log.Impact = impact.ToString(); log.MessageName = messageName.ToString(); log.MessageDescription = messageDescription; Task.Run(() => { ICCCConnection.INSTANCE.send2Any(log, ICCCKind.KindOcean); }); }