Ejemplo n.º 1
0
 /// <summary>
 /// Log Message in the Application.
 /// </summary>
 /// <param name="message">A string type representing the message that needs to be logged.</param>
 /// <param name="source">A Source type representing the part of the application that raised the exception.</param>
 /// <param name="logCategory">A LogCategory type representing the tyoe of logging that needs to be done.</param>
 public static void LogMessage(string message, Source source, params LogCategory[] logCategory)
 {
     ILogger logger = new ApplicationLogger();
     logger.WriteLogEntry(
         message,
         logCategory,
         Constant.DEFAULTPRIORITY,
         TraceEventType.Information,
         source,
         DateTime.UtcNow);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Log Exception in the Application along with custom Message.
 /// </summary>
 /// <param name="message">A string type representing the custom message.</param>
 /// <param name="exception">An Exception type representing the exception that needs to be logged.</param>
 /// <param name="source">A Source type representing the part of the application that raised the exception.</param>
 public static void LogException(string message, Exception exception, Source source)
 {
     ILogger logger = new ApplicationLogger();
     LogCategory[] logCategories = { LogCategory.Exception };
     logger.WriteLogEntry(
         PrepareLogMessage(exception, message),
         logCategories,
         Constant.DEFAULTPRIORITY,
         TraceEventType.Error,
         source,
         DateTime.UtcNow);
 }