/// <summary> /// Instance method to write an string in the event log. /// </summary> /// <param name="eventInfo">String to write in the event log.</param> protected virtual void WriteToEventLog(string eventInfo, EventLogEntryType eventLogEntryType) { Exception result; var appId = this.GetApplicationIdentity(); AbstractLogger.TryWriteToEventLog(appId, eventInfo, eventLogEntryType, out result); }
/// <summary> /// Instance method to write an exception in the event log. Construct string with messages and stack trace from the exception /// and all inner exceptions(message and stack trace included). /// </summary> /// <param name="exception"></param> protected virtual void WriteExceptionToEventLog(Exception exception) { Exception result; var appId = this.GetApplicationIdentity(); AbstractLogger.TryWriteExceptionToEventLog(appId, exception, out result); }
/// <summary> /// Write a warning to Unity event log /// </summary> /// <param name="info"></param> public static bool WriteWarningToEventLog(string info) { if (_applicationName == null) { _applicationName = GetApplicationName(); } Exception resultException; var result = AbstractLogger.TryWriteToEventLog(_applicationName ?? string.Empty, info, EventLogEntryType.Warning, out resultException); return(result); }
/// <summary> /// Write the exception to Unity event log /// </summary> /// <param name="exceptionToLog"></param> public static bool WriteExceptionToEventLog(Exception exceptionToLog) { if (_applicationName == null) { _applicationName = GetApplicationName(); } Exception resultException; var result = AbstractLogger.TryWriteExceptionToEventLog(_applicationName ?? string.Empty, exceptionToLog, out resultException); return(result); }
/// <summary> /// Static method that tries to write an exception in the event log and return true or false in case of success or failure respectively. Result object contains the details of the exception /// trown during the process, null if it succeeds /// </summary> /// <param name="appId">The event log source. It has to be configured during the instalation. Otherwise the message will be logged against the default source /// provided by LogEventSourceProvider implementation</param> /// <param name="exception">An exeption to be logged. Construct string with messages and stack trace from the exception /// and all inner exceptions(message and stack trace included).</param> /// <param name="result">An object of type Exception with all exception thrown during the logging process.</param> /// <returns>True if the process succeeds, false otherwise. result object see result for details</returns> public static bool TryWriteExceptionToEventLog(string appId, Exception exception, out Exception result) { string builtMessage = LoggerManager.BuildExceptionStringRecursively(exception); return(AbstractLogger.TryWriteToEventLog(appId, builtMessage, EventLogEntryType.Error, out result)); }