Beispiel #1
0
        public void Log(string message, LoggingCategory loggingCategory, LoggingPriority loggingPriority)
        {
            LogEntry entry = new LogEntry();

            entry.Message = message;
            entry.Categories.Add(loggingCategory.ToString());
            entry.Priority = (int)Enum.Parse(typeof(LoggingPriority), loggingPriority.ToString());
            Logger.Write(entry);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="LogEventArgs"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="eventId">The event id.</param>
 /// <param name="priority">The priority.</param>
 /// <param name="severity">The severity.</param>
 /// <externalUnit cref="Message"/>
 /// <externalUnit cref="EventId"/>
 /// <externalUnit cref="Priority"/>
 /// <externalUnit cref="Severity"/>
 /// <revision revisor="dev06" date="10/6/2008" version="1.0.0.0">
 ///     Member created
 /// </revision>
 public LogEventArgs(
     string message,
     int eventId,
     LoggingPriority priority,
     TraceEventType severity)
 {
     // set the properties
     this.Message  = message;
     this.EventId  = eventId;
     this.Priority = priority;
     this.Severity = severity;
 }
Beispiel #3
0
 /// <summary>
 /// Writes the specified message with category and priority.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="category">The category.</param>
 /// <param name="prio">The prio.</param>
 public static void Write(object message, string category, LoggingPriority prio)
 {
     Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(message, category, (int)prio);
 }
Beispiel #4
0
        private static void TryWrite(string message, Exception exception, string title, int eventId,
                                     IDictionary<string, object> extendedProperties, LoggingPriority priorty,
                                     TraceEventType traceEventType)
        {
            if (!Writer.IsLoggingEnabled()) return;

            Writer.Write(FormatMessage(message, exception), GeneralCategory, (int) priorty, eventId, traceEventType,
                         title, extendedProperties);
        }