Exemple #1
0
        public static string ToString(this LoggerVerbosity verbosity, bool useShortSwitchNames)
        {
            if (!useShortSwitchNames)
            {
                return(verbosity.ToString());
            }

            switch (verbosity)
            {
            case LoggerVerbosity.Detailed:
                return("d");

            case LoggerVerbosity.Diagnostic:
                return("diag");

            case LoggerVerbosity.Minimal:
                return("m");

            case LoggerVerbosity.Normal:
                return("n");

            case LoggerVerbosity.Quiet:
                return("q");
            }

            throw new InvalidOperationException($"Unknown LoggerVerbosity value '{verbosity}'");
        }
Exemple #2
0
 private static void SetSelectedValue(object sender, EventArgs e)
 {
     if (e is OleMenuCmdEventArgs args)
     {
         if (args.OutValue != IntPtr.Zero)
         {
             // Set the initial value on load
             LoggerVerbosity verbosity = _settings.GetValueOrDefault(_settingName, LoggerVerbosity.Minimal);
             Marshal.GetNativeVariantForObject(verbosity.ToString(), args.OutValue);
         }
         else if (args.InValue is int index)
         {
             // Save the value on manual selection from dropdown
             _settings.SetValueAsync(_settingName, index, false).FileAndForget(nameof(OutputVerbosity));
         }
     }
 }
Exemple #3
0
        public void FromLoggerVerbosity(LoggerVerbosity v, string expectedResult)
        {
            var s = String.Join(" ", VerbosityUtils.GetVerbosityLevel(v));

            Assert.That(s, Is.EqualTo(expectedResult), v.ToString());
        }
 public void FromLoggerVerbosity(LoggerVerbosity v, string expectedResult)
 {
     Assert.That(VerbosityUtils.GetVerbosityLevel(v), Is.EqualTo(expectedResult), v.ToString());
 }
Exemple #5
0
 protected string GetVerbositySwitch(LoggerVerbosity verbosity, bool useShortSwitchNames)
 {
     return($"{(useShortSwitchNames ? "v" : "Verbosity")}={(useShortSwitchNames ? verbosity == LoggerVerbosity.Diagnostic ? "diag" : verbosity.ToString().ToLowerInvariant().Substring(0, 1) : verbosity.ToString())}");
 }