/// <summary> /// Initializes a new instance of the <see cref="LogTag" /> class. Use this version if you want to nest other tags /// underneath this tag. /// <para></para> /// <para> /// If a parent is active, all nested tags are also considered active. /// </para> /// <para> /// NOTE: LogTags are clever enough not to loop forever when checking if parent tags are active but there's no /// other checking for how you manage your nesting, so be sensible. /// </para> /// </summary> /// <param name="name">The tag name.</param> /// <param name="childLogTags">The child log tags, each of which will be updated to make this tag their parent.</param> /// <param name="parentLogTag">The parent log tag.</param> public LogTag(string name, IEnumerable <LogTag> childLogTags, LogTag parentLogTag = null) { Name = name; EncounteredLogTags.Add(this); foreach (LogTag childLogTag in childLogTags) { childLogTag.Parent = this; } Parent = parentLogTag; }
/// <summary> /// Initializes a new instance of the <see cref="LogTag" /> class. Use this version if you want to nest this tag under /// another existing tag. /// <para> /// If a parent is active, all nested tags are also considered active. /// </para> /// <para> /// NOTE: LogTags are clever enough not to loop forever when checking if parent tags are active but there's no /// other checking for how you manage your nesting, so be sensible. /// </para> /// </summary> /// <param name="name">The tag name.</param> /// <param name="parentLogTag">A parent log tag so that you can group and nest tags.</param> public LogTag(string name, LogTag parentLogTag) { Name = name; Parent = parentLogTag; EncounteredLogTags.Add(this); }
/// <summary> /// Initializes a new instance of the <see cref="LogTag" /> class. /// </summary> /// <param name="name">The tag name.</param> public LogTag(string name) { Name = name; EncounteredLogTags.Add(this); }