Esempio n. 1
0
        /// <summary>
        /// Logs the specified message to <see cref="Trace"/>.
        /// </summary>
        /// <param name="level">The trace level</param>
        /// <param name="message">The message</param>
        /// <param name="args">The args</param>
        public void Log(MessageLevel level, string message, params object[] args)
        {
            var traceLevel = level.ToTraceLevel();

            switch (traceLevel)
            {
            case TraceLevel.Error: Trace.TraceError(message, args); break;

            case TraceLevel.Info: Trace.TraceInformation(message, args); break;

            case TraceLevel.Warning: Trace.TraceWarning(message, args); break;

            case TraceLevel.Verbose: Trace.WriteLine(string.Format(message, args)); break;
            }
        }
Esempio n. 2
0
 public void Convert_levels(MessageLevel input, TraceLevel expected)
 {
     input.ToTraceLevel().Should().Be(expected);
 }