Esempio n. 1
0
 /// <summary>
 /// Writes a single log item
 /// </summary>
 /// <param name="item"></param>
 private void WriteItem(LogPortion item)
 {
     CheckDb();
     database.ExecuteCommand(
         "Insert into Log (EventTime, Severity, EventContext, EventText) values ($eventTime, $severity, $eventContext, $eventText)",
         database.GetParameter("eventTime", item.EventTime),
         database.GetParameter("severity", item.Severity),
         database.GetParameter("eventContext", item.Context),
         database.GetParameter("eventText", item.EventText));
 }
Esempio n. 2
0
        /// <summary>
        /// Logs an event to this Log-Target
        /// </summary>
        /// <param name="eventText">the event-text</param>
        /// <param name="severity">the severity of the event</param>
        /// <param name="context">provides additional information about the logging-context in which the message was generated</param>
        protected override void Log(string eventText, int severity, string context)
        {
            var portion = new LogPortion
            {
                Context   = context,
                EventText = eventText,
                Severity  = severity,
                EventTime = DateTime.Now
            };

            logQueue.Enqueue(portion);
            workEvent.Set();
        }