Пример #1
0
    private static void OnLog(LogEvents type, string text)
    {
      if (_Log == null)
        return;

      _Log(null, new LogEventArgs(type, text));
    }
Пример #2
0
    ///<summary>
    /// Set the events that will be written to the log. The log will be written to the Log event
    /// and the debug window in VisualStudio. To change the log settings you must use a custom
    /// log.xml file.
    ///</summary>
    ///<param name="events">The events that will be logged.</param>
    public static void SetLogEvents(LogEvents events)
    {
      _LogEvents = events;

      if (_Log != null)
        SetLogEvents();
    }
Пример #3
0
        /// <summary>
        /// Loads the content of the Log from Sqlite.
        /// </summary>
        /// <param name="xmlReader">The XmlReader instance containing the data.</param>
        public void LoadSqlite(string filePath)
        {
            if (filePath.IsNullOrBlank()) throw new ArgumentNullException("filePath");
            if (!File.Exists(filePath)) throw new FileNotFoundException(String.Format("Specified File '{0}' not found.", filePath), filePath);

            using (SqliteDataContext context = new SqliteDataContext(filePath))
            {
                LogEvents logEvents = new LogEvents(context.LogEvents);
                Entries.AddRange(logEvents.Select(logEvent => (LogEntry) logEvent));
            }
        }
Пример #4
0
 internal LogEventArgs(LogEvents eventType, string message)
 {
   EventType = eventType;
   Message = message;
 }
Пример #5
0
 /// <summary>
 /// Logs an event for an account.
 /// </summary>
 /// <param name="userid"></param>
 /// <param name="eventType"></param>
 /// <param name="additionalInfo"></param>
 public static void logEvent(string userid, LogEvents eventType, string additionalInfo, Connector conn)
 {
     conn.Query_Execute("INSERT INTO bsa_user_log (userid, event_type, date, additional_info) VALUES('" + Utils.Escape(userid) + "', '" + (int)eventType + "', NOW(), " + (additionalInfo != null ? "'" + Utils.Escape(additionalInfo) + "'" : "NULL") + ")");
 }