/// <summary> /// Log a Trace event. /// </summary> /// <param name="message"></param> /// <param name="loggerMessageCategory"></param> public async Task LogAsync(string message, LoggerMessageCategory loggerMessageCategory) { await this._serviceLogger.WriteMessageAsync(loggerMessageCategory, message); if (loggerMessageCategory == LoggerMessageCategory.Error) { this._lastError.Append(message); } }
/// <summary> /// Log a Trace event. /// </summary> /// <param name="message">Error Message</param> /// <param name="loggerMessageCategory">Trace Event type Information</param> /// <param name="exception">Exception object</param> public async Task LogAsync(string message, LoggerMessageCategory loggerMessageCategory, Exception exception) { var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Message: " + message); TraceLogger.LogExceptionToFile(exception, stringBuilder, 0); if (stringBuilder.Length > 0) { await this._serviceLogger.WriteMessageAsync(LoggerMessageCategory.Error, stringBuilder.ToString()); } else { await this._serviceLogger.WriteMessageAsync(loggerMessageCategory, stringBuilder.ToString()); } if (loggerMessageCategory == LoggerMessageCategory.Error) { this._lastError.Append(stringBuilder); this._lastException = exception; } }