public static void SendMessage(TestMessageLevel level, string msg) { if( _logger != null ) { _logger.SendMessage(level, msg); } }
public void SendMessage(TestMessageLevel logLevel, string message) { if (CanLog) { messageLogger.SendMessage(logLevel, message); } }
public override void SendMessage(TestMessageLevel testMessageLevel, string message) { try { _logger.SendMessage(testMessageLevel, FormatMessage(testMessageLevel, message)); } catch { } }
private void LogSafe(TestMessageLevel level, string message) { if (string.IsNullOrWhiteSpace(message)) { // Visual Studio 2013 is very picky about empty lines... // But it accepts an 'INVISIBLE SEPARATOR' (U+2063) :-) message = "\u2063"; } lock (Lock) { Logger.SendMessage(level, message); } }
public static Severity GetSeverity(this TestMessageLevel level) { switch (level) { case TestMessageLevel.Informational: return(Severity.Info); case TestMessageLevel.Warning: return(Severity.Warning); case TestMessageLevel.Error: return(Severity.Error); default: throw new InvalidOperationException(String.Format(Resources.UnknownEnum, level)); } }
void IMessageLogger.SendMessage(TestMessageLevel testMessageLevel, string message) { TextMessage textMessage = new TextMessage() { Level = testMessageLevel, Text = message }; Events.Add(new Event() { EventType = EventType.SendMessage, Message = textMessage }); }
void IMessageLogger.SendMessage(TestMessageLevel testMessageLevel, string message) { var textMessage = new TextMessage { Level = testMessageLevel, Text = message }; Events.Add(new Event { EventType = EventType.SendMessage, Message = textMessage }); }
public static Severity GetSeverity(this TestMessageLevel level) { switch (level) { case TestMessageLevel.Informational: return(Severity.Info); case TestMessageLevel.Warning: return(Severity.Warning); case TestMessageLevel.Error: return(Severity.Error); default: throw new InvalidOperationException($"Unknown enum literal: {level}"); } }
void LogNormal(TestMessageLevel level, string msg) { if (_logger == null) { return; } if (_settings == null || _settings.LoggingLevel == Catch2Interface.LoggingLevels.Normal || _settings.LoggingLevel == Catch2Interface.LoggingLevels.Verbose) { _logger.SendMessage(level, msg); } }
private void LogVerbose(TestMessageLevel level, string msg) { if (_frameworkHandle == null) { return; } if (_settings == null || _settings.LoggingLevel == Catch2Interface.LoggingLevels.Verbose || _settings.LoggingLevel == Catch2Interface.LoggingLevels.Debug) { _frameworkHandle.SendMessage(level, msg); } }
/// <summary> /// Initializes with the level and the message for the event. /// </summary> /// <param name="level">Level of the message.</param> /// <param name="message">The message.</param> public TestRunMessageEventArgs(TestMessageLevel level, string message) { if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentException(CommonResources.CannotBeNullOrEmpty, nameof(message)); } if (level < TestMessageLevel.Informational || level > TestMessageLevel.Error) { throw new ArgumentOutOfRangeException(nameof(level)); } Level = level; Message = message; }
public void HandleLogMessage(TestMessageLevel level, string message) { if (_discoveryCompletionSource.Task.IsCompleted) { // PENDING: vstest error, log this return; } if (message == null) { // PENDING: vstest error, log this return; } RaiseMessageReceived(level, message); }
public void SendMessage(TestMessageLevel testMessageLevel, string message, Exception ex) { switch (Verbosity) { case 0: var type = ex.GetType(); SendMessage(testMessageLevel, string.Format(EXCEPTION_FORMAT, type, message)); SendMessage(testMessageLevel, ex.Message); break; default: SendMessage(testMessageLevel, message); SendMessage(testMessageLevel, ex.ToString()); break; } }
/// <summary> /// Sends the message. /// </summary> /// <param name="testMessageLevel">The test message level.</param> /// <param name="message">The message.</param> public void SendMessage(TestMessageLevel testMessageLevel, string message) { switch (testMessageLevel) { case TestMessageLevel.Informational: Console.Out.WriteLine(message); break; case TestMessageLevel.Warning: case TestMessageLevel.Error: Console.Error.WriteLine(message); break; default: throw new NotSupportedException($"TestMessageLevel: {testMessageLevel}"); } }
public static string GetShortName(this TestMessageLevel testMessageLevel) { switch (testMessageLevel) { case TestMessageLevel.Informational: return("INFO"); case TestMessageLevel.Warning: return("WARN"); case TestMessageLevel.Error: return("FAIL"); default: return("MISC"); } }
protected MessageLevel GetMessageLevel(TestMessageLevel level) { switch (level) { case TestMessageLevel.Informational: return(MessageLevel.Informational); case TestMessageLevel.Warning: return(MessageLevel.Warning); case TestMessageLevel.Error: return(MessageLevel.Error); default: return(MessageLevel.Error); } }
private void LogSafe(TestMessageLevel level, string message) { if (_settings.TimestampOutput) Utils.TimestampMessage(ref message); if (string.IsNullOrWhiteSpace(message)) { // Visual Studio 2013 is very picky about empty lines... // But it accepts an 'INVISIBLE SEPARATOR' (U+2063) :-) message = "\u2063"; } lock (Lock) { _logger.SendMessage(level, message); } }
/// <summary> /// Invoked when log messages are received /// </summary> public void HandleLogMessage(TestMessageLevel level, string message) { EqtTrace.Verbose("TestRunRequest:SendTestRunMessage: Starting."); lock (this.syncObject) { // If this object is disposed, dont do anything if (this.disposed) { EqtTrace.Warning("TestRunRequest.SendTestRunMessage: Ignoring as the object is disposed."); return; } this.TestRunMessage.SafeInvoke(this, new TestRunMessageEventArgs(level, message), "TestRun.LogMessages"); } EqtTrace.Info("TestRunRequest:SendTestRunMessage: Completed."); }
/// <summary> /// Sends a message to all listeners. /// </summary> /// <param name="testMessageLevel">Level of the message.</param> /// <param name="message">The message to be sent.</param> public void SendMessage(TestMessageLevel testMessageLevel, string message) { if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentException(ObjectModelCommonResources.CannotBeNullOrEmpty, nameof(message)); } if (this.TreatTestAdapterErrorsAsWarnings && testMessageLevel == TestMessageLevel.Error) { // Downgrade the message severity to Warning... testMessageLevel = TestMessageLevel.Warning; } if (this.TestRunMessage != null) { var args = new TestRunMessageEventArgs(testMessageLevel, message); this.TestRunMessage.SafeInvoke(this, args, "TestRunMessageLoggerProxy.SendMessage"); } }
private void LogSafe(TestMessageLevel level, string message) { if (_settings.TimestampOutput) { string timestamp = DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture); message = $"{timestamp} - {message ?? ""}"; } if (string.IsNullOrWhiteSpace(message)) { // Visual Studio 2013 is very picky about empty lines... // But it accepts an 'INVISIBLE SEPARATOR' (U+2063) :-) message = "\u2063"; } lock (Lock) { _logger.SendMessage(level, message); } }
public void HandleLogMessage(TestMessageLevel level, string message) { switch ((TestMessageLevel)level) { case TestMessageLevel.Informational: EqtTrace.Info(message); break; case TestMessageLevel.Warning: EqtTrace.Warning(message); break; case TestMessageLevel.Error: EqtTrace.Error(message); break; default: EqtTrace.Info(message); break; } }
private void AppendOutputPrefix(StringBuilder builder, TestMessageLevel level) { if (_prefixOutput()) { builder.Append("GTA"); } var timestampMode = _timeStampMode(); if (timestampMode == TimestampMode.PrintTimestamp || timestampMode == TimestampMode.Automatic && !VsVersionUtils.VsVersion.PrintsTimeStampAndSeverity()) { if (builder.Length > 0) { builder.Append(' '); } builder.Append(Utils.GetTimestamp()); } var severityMode = _severityMode(); if (level > TestMessageLevel.Informational && (severityMode == SeverityMode.PrintSeverity || severityMode == SeverityMode.Automatic && !VsVersionUtils.VsVersion.PrintsTimeStampAndSeverity())) { if (builder.Length > 0) { builder.Append(' '); } builder.Append(GetSeverity(level)); } if (builder.Length > 0) { builder.Insert(0, '['); builder.Append("] "); } }
private void LogSafe(TestMessageLevel level, string message) { if (_timeStampOutput()) { Utils.TimestampMessage(ref message); } if (string.IsNullOrWhiteSpace(message)) { // Visual Studio 2013 is very picky about empty lines... // But it accepts an 'INVISIBLE SEPARATOR' (U+2063) :-) message = "\u2063"; } _logger.SendMessage(level, message); ReportFinalLogEntry( new LogEntry { Severity = level.GetSeverity(), Message = message }); }
/// <summary> /// Method that accepts a message along with the severity level so as to be printed onto the tests output tab /// </summary> /// <param name="testMessageLevel">level parameter used to indicate the severity of the message</param> /// <param name="message">text message that needs to be printed</param> /// <remarks>In case the Logger is not properly initialized then any messages are simply discared without raising any exceptions</remarks> public static void SendMessage(TestMessageLevel testMessageLevel, string message) { if (_loggerInstance != null) { _loggerInstance.SendMessage(testMessageLevel, message); } switch (testMessageLevel) { case TestMessageLevel.Informational: log4netLogger.Info(message); break; case TestMessageLevel.Warning: log4netLogger.Warn(message); break; case TestMessageLevel.Error: log4netLogger.Error(message); break; } }
/// <summary> /// Method that accepts a message along with the severity level so as to be printed onto the tests output tab /// </summary> /// <param name="testMessageLevel">level parameter used to indicate the severity of the message</param> /// <param name="message">text message that needs to be printed</param> /// <remarks>In case the Logger is not properly initialized then any messages are simply discarded without raising any exceptions</remarks> public static void SendMessage(TestMessageLevel testMessageLevel, string message) { if (_loggerInstance != null) { _loggerInstance.SendMessage(testMessageLevel, message); } switch (testMessageLevel) { case TestMessageLevel.Informational: log4netLogger.Info(message); break; case TestMessageLevel.Warning: log4netLogger.Warn(message); break; case TestMessageLevel.Error: log4netLogger.Error(message); break; } }
public void SendMessage(TestMessageLevel testMessageLevel, string message, Exception ex) { switch (Verbosity) { case 0: var type = ex.GetType(); SendMessage(testMessageLevel, string.Format(EXCEPTION_FORMAT, type, message)); SendMessage(testMessageLevel, ex.Message); SendMessage(testMessageLevel, ex.StackTrace); if (ex.InnerException != null) { SendMessage(testMessageLevel, $"Innerexception: {ex.InnerException.ToString()}"); } break; default: SendMessage(testMessageLevel, message); SendMessage(testMessageLevel, ex.ToString()); SendMessage(testMessageLevel, ex.StackTrace); break; } }
public void HandleLogMessage(TestMessageLevel level, string message) { LogLevel levelFinal; switch (level) { case TestMessageLevel.Informational: levelFinal = LogLevel.Debug; break; case TestMessageLevel.Warning: levelFinal = LogLevel.Warning; break; case TestMessageLevel.Error: levelFinal = LogLevel.Error; break; default: throw new ArgumentOutOfRangeException(nameof(level), level, null); } _logger.LogTrace($"{_runnerId}: [{levelFinal}] {message}"); }
void IMessageLogger.SendMessage(TestMessageLevel testMessageLevel, string message) { }
/// <summary> /// Logs the provided message at the requested severity level. Uses a format, args pair to construct the log message. /// </summary> /// <param name="testMessageLevel">level parameter used to indicate the severity of the message</param> /// <param name="format">Format string</param> /// <param name="args">Arguments for the format string</param> public static void SendMessage(TestMessageLevel testMessageLevel, string format, params object[] args) { SendMessage(testMessageLevel, string.Format(CultureInfo.InvariantCulture, format, args)); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { this.TestMessageLevel = testMessageLevel; this.Message = message; }
protected MessageLevel GetMessageLevel(TestMessageLevel level) { switch (level) { case TestMessageLevel.Informational: return MessageLevel.Informational; case TestMessageLevel.Warning: return MessageLevel.Warning; case TestMessageLevel.Error: return MessageLevel.Error; default: return MessageLevel.Error; } }
void SendMessage(TestMessageLevel level, string assemblyName, string message) { var assemblyText = assemblyName == null ? "" : $"{Path.GetFileNameWithoutExtension(assemblyName)}: "; InnerLogger.SendMessage(level, $"[xUnit.net {Stopwatch.Elapsed}] {assemblyText}{message}"); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { _monitor.RecordMessage(testMessageLevel.Convert(), message.PadLinesLeft(" ")); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { Console.WriteLine("{0}: {1}", testMessageLevel, message); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { var consoleOutput = String.Format("{0}) {1}", messageLevelToTextMap[testMessageLevel], message); Console.WriteLine(consoleOutput); }
public override void SendMessage(TestMessageLevel testMessageLevel, string message) { Log(GetMessageLevel(testMessageLevel), message); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { // Do nothing }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { Messages.Add(string.Format("{0}:{1}", testMessageLevel, message)); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { if (MessageLogger != null) MessageLogger.SendMessage(testMessageLevel, message); }
void IMessageLogger.SendMessage(TestMessageLevel testMessageLevel, string message) { Assert.That(message, Does.Not.Contain("failed to load")); }
protected string LevelText(TestMessageLevel level) { return LevelText(GetMessageLevel(level)); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) => NotImplemented();
protected string FormatMessage(TestMessageLevel level, string message) { return FormatMessage(GetMessageLevel(level), message); }
void ITestDiscoveryMonitor.RecordMessage(TestMessageLevel testMessageLevel, string message) { MessageReceived?.Invoke(this, new EventArgs <string>(message)); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { throw new NotImplementedException(); }
public static string FormatMessage(this ITestLogger logger, TestMessageLevel level, string message) { return logger.FormatMessage(level.GetTestLogLevel(), logger.Context, message); }
public override void SendMessage(TestMessageLevel testMessageLevel, string message) { foreach (var logger in _loggers) { try { logger.SendMessage(testMessageLevel, message); } catch { } } }
private static void SendMessage(TestMessageLevel level, string message, IMessageLogger logger) { if (logger != null) { logger.SendMessage(level, message); } }
void SendMessage(TestMessageLevel level, string assemblyName, string message) { var assemblyText = assemblyName == null ? "" : string.Format("{0}: ", Path.GetFileNameWithoutExtension(assemblyName)); InnerLogger.SendMessage(level, string.Format("[xUnit.net {0}] {1}{2}", Stopwatch.Elapsed, assemblyText, message)); }
public void SendMessage(TestMessageLevel testMessageLevel, string message) { this.Messages.Add(new Tuple<TestMessageLevel, string>(testMessageLevel, message)); }