// Methods
 internal NewMessageEventArgs(LogEvent ev)
 {
     _evnt = ev;
 }
Exemple #2
0
        public void WriteEntry(object sender, string message, EventEntryType type)
        {
            if (type < _logLevel)
                return;

            LogEvent item = new LogEvent (sender, message, type);

            lock (this.eventQueue) {
                this.eventQueue.Enqueue (item);
                this.flag.Set ();
            }
            if (this.NewMessage != null) {
                NewMessage.DynamicInvoke (new object[] { this, new NewMessageEventArgs (item) });
            }
        }
Exemple #3
0
 internal string LogNote(LogEvent message)
 {
     Object o = message.Sender;
     return string.Format("[{0} : {1} : {2}] {3}",
         message.Time.ToString(_dateTimeFormatLogRecord),
         message.Type.ToString(),
         o.GetType().ToString(),
         message.Message);
 }
Exemple #4
0
 public string LogNote(LogEvent evnt)
 {
     return _fileLogger.LogNote (evnt);
 }
Exemple #5
0
 public void Append(LogEvent message)
 {
     DateTime now = DateTime.Now;
     TimeSpan span = (TimeSpan)(now - _lastClearTime);
     if (span.TotalSeconds > 60.0)
     {
         this._lastClearTime = now;
         this.CloseUnusedFiles(this._lastClearTime);
     }
     string key = this.LogFileNamePath;
     try
     {
         if (!this._openFiles.ContainsKey(key))
         {
             this._openFiles[key] = new TimeStreamWriter(key, this._encoding);
         }
         this._openFiles[key].StreamWriter.WriteLine(this.LogNote(message));
     }
     catch (NotImplementedException) { throw; }
     catch { }
 }