private static LoggerItem CreateLoggerItem(string name, string fullName, LoggerItem parent) { if (parent == null) throw new ArgumentNullException(); // Creating the logger item. LoggerItem logger = new LoggerItem(); logger.Name = name; logger.FullName = fullName; logger.Parent = parent; logger._logListView = logger.Parent._logListView; // Adding the logger as a child of the parent logger. logger.Parent.Loggers.Add(name, logger); // Creating a child logger view and saving it in the new logger. logger.LoggerView = parent.LoggerView.AddNew(name, logger); // Group if (UserSettings.Instance.GroupLogMessages) { logger.Group = new ListViewGroup(fullName); logger._logListView.Groups.Add(logger.Group); } return logger; }
public static LoggerItem CreateRootLoggerItem(string name, ILoggerView loggerView, ListView logListView) { LoggerItem logger = new LoggerItem(); logger.Name = name; logger._logListView = logListView; // Tree Node logger.LoggerView = loggerView.AddNew(name, logger); return logger; }
/// <summary> /// Adds the new logger view as a child of the current view and returns the new view. /// </summary> /// <param name="text">The text to initialize the view with.</param> /// <param name="logger">The logger that this instance is a view of.</param> /// <returns></returns> public ILoggerView AddNew(string text, LoggerItem logger) { // Creating a new node. TreeNode node = new TreeNode(text) {Checked = true, Tag = logger}; if (_isRoot) { _treeView.Nodes.Add(node); } else { _node.Nodes.Add(node); } node.EnsureVisible(); return new TreeViewLoggerView(_treeView, node); }
public void Initialize(ILoggerView loggerView, ListView logListView) { // Root Logger _rootLoggerItem = LoggerItem.CreateRootLoggerItem("Root", loggerView, logListView); // Quick Access Logger Collection _fullPathLoggers = new Dictionary<string, LoggerItem>(); }
public LogMessageItem(LoggerItem parent, LogMessage logMsg) { Parent = parent; Message = logMsg; string parentName = Parent.Name; if ((Parent.Name == logMsg.ThreadName) && (Parent.Parent != null)) parentName = Parent.Parent.Name; // Create List View Item Item = new ListViewItem(logMsg.TimeStamp.ToString(UserSettings.Instance.TimeStampFormatString)); //Item.SubItems.Add(logMsg.Level.Name); Item.SubItems.Add(parentName); Item.SubItems.Add(logMsg.ThreadName); Item.SubItems.Add(logMsg.Message); Item.ToolTipText = logMsg.Message; Item.ForeColor = logMsg.Level.Color; Item.Tag = this; }