public NewEntryEventArgs(LogEntry entry)
        {
            if (entry == null)
                throw new ArgumentNullException("entry");

            this.entry = entry;
        }
 protected virtual void OnNewEntry(LogEntry entry)
 {
     if (NewEntry != null)
         NewEntry(this, new NewEntryEventArgs(entry));
 }
        public virtual void Log(string message, string[] tags = null, object sender = null, EntryCategory category = EntryCategory.Information)
        {
            LogEntry entry = new LogEntry(DateTime.Now, message, tags, sender, category);

            Log(entry);
        }
        public virtual void Log(LogEntry entry)
        {
            ISet<ILogHandler> handlersToRemove = new HashSet<ILogHandler>();

            lock (this)
            {
                if (Parent != null)
                    Parent.Log(entry);
                else
                {
                    if (!Senders.Contains(entry.Sender))
                    {
                        Senders.Add(entry.Sender);
                        OnNewSender(entry.Sender);
                    }

                    if (entry.Tags != null)
                    {
                        foreach (string tag in entry.Tags)
                        {
                            if (!Tags.Contains(tag))
                            {
                                Tags.Add(tag);
                                OnNewTag(tag);
                            }
                        }
                    }

                    Entries.Add(entry);
                    OnNewEntry(entry);

                    foreach (ILogHandler handler in LogHandlers)
                    {
                        try
                        {
                            handler.Write(entry);
                        }
                        catch (ObjectDisposedException)
                        {
                            handlersToRemove.Add(handler);
                        }
                    }

                    foreach (ILogHandler handler in handlersToRemove)
                        LogHandlers.Remove(handler);
                }
            }
        }