/// <summary> /// Initializes a new <see cref="DiagnosticEventType"/> with the specified /// <paramref name="value"/> /// </summary> /// <param name="value">The name of the event type</param> /// <param name="level">An indication of the purpose and relative importance of this event</param> public DiagnosticEventType(string value, DiagnosticEventLevel level = DiagnosticEventLevel.Debug) { if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentNullException(nameof(value)); } Name = value.Trim(); Level = level; }
/// <summary> /// Returns the syslog level corresponding to the specified diagnostic event /// <paramref name="level"/> /// </summary> /// <param name="level">The diagnostic event level</param> /// <returns>Returns the syslog level corresponding to the specified diagnostic event /// level</returns> protected int GetSyslogLevel(DiagnosticEventLevel level) { return(SyslogLevels.TryGetValue(level, out int syslogLevel) ? syslogLevel : 7); }
/// <summary> /// Initializes a new <see cref="DiagnosticEventLevelSpecification"/> with the specified /// range of <see cref="DiagnosticEventLevel"/>s /// </summary> /// <param name="minLevel">The minimum level required to satisfy the specification</param> /// <param name="maxLevel">The maximum level allowed to satisfy the specification</param> public DiagnosticEventLevelSpecification(DiagnosticEventLevel minLevel, DiagnosticEventLevel maxLevel) { _minLevel = minLevel; _maxLevel = maxLevel; }
protected void GivenMaxLevel(DiagnosticEventLevel level) { MaxLevel = level; }
protected void GivenEventWithLevel(DiagnosticEventLevel level) { var diagnosticEventType = new DiagnosticEventType("TestDebug", level); Event = new DiagnosticEventBuilder(this, diagnosticEventType).Build(); }