public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity) { if (severity == Severity.Warning && !ReportWarning(_context.Verbose, errorCode)) { return; } CountError(severity); string path; string codeLine; int line = span.Start.Line; if (sourceUnit != null) { path = sourceUnit.Path; codeLine = (line > 0) ? sourceUnit.GetCodeLine(line) : null; } else { path = null; codeLine = null; } if (severity == Severity.Error || severity == Severity.FatalError) { throw new SyntaxError(message, path, line, span.Start.Column, codeLine); } else { if (_WriteSite == null) { Interlocked.CompareExchange( ref _WriteSite, CallSite<Func<CallSite, object, object, object>>.Create(RubyCallAction.Make(_context, "write", 1)), null ); } message = RubyContext.FormatErrorMessage(message, "warning", path, line, span.Start.Column, null); _WriteSite.Target(_WriteSite, _context.StandardErrorOutput, MutableString.CreateMutable(message)); } }
// Token: 0x0600175E RID: 5982 // RVA: 0x0007310C File Offset: 0x0007130C public AiReportTwoObjects(HitObjectBase h1, HitObjectBase h2, BeenCorrectedDelegate corrected, Severity severity, string information, int weblink) : base((h1.EndTime - h2.StartTime) / 2 + h2.StartTime, severity, information, weblink, corrected) { this.h1 = h1; this.h2 = h2; this.RelatedHitObjects.Add(h1); this.RelatedHitObjects.Add(h2); }
public OutputMessage(string message, enum_MESSAGETYPE messageType, Severity severity, uint errorCode = 0) { this.Message = message; this.MessageType = messageType; this.SeverityValue = severity; this.ErrorCode = errorCode; }
public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity) { if (severity == Severity.Warning) { PythonOps.SyntaxWarning(message, sourceUnit, span, errorCode); } else { throw PythonOps.SyntaxError(message, sourceUnit, span, errorCode); } }
public void CalculatesPriorityValueCorrectly(Facility facility, Severity severity, int expectedPriorityValue) { var msg = CreateMinimalSyslogMessage(facility, severity); string serializedMsg = sut.Serialize(msg); Assert.Equal(String.Format("<{0}>1 - - - - -", expectedPriorityValue), serializedMsg); }
public LoggerMessage(Severity severity, int threadId, string threadName, string message) { Severity = severity; ThreadId = threadId; ThreadName = threadName; Message = message; }
/// <summary> /// Initializes a new instance of the <see cref="AreNotEqual" /> class. /// </summary> /// <param name="name"> The name. </param> /// <param name="message"> The message. </param> /// <param name="target"> The target. </param> /// <param name="comparisonTarget"> The comparison target. </param> /// <param name="severity"> The severity. </param> public AreNotEqual(string name, string message, object target, object comparisonTarget, Severity severity) : base(name, message) { this.target = target; this.comparisonTarget = comparisonTarget; Severity = severity; }
public FormatError(byte[] buffer, int ptr, Severity sev, string msg) { _buf = buffer; _offset = ptr; _severity = sev; _message = msg; }
public override void ErrorReported(ScriptSource source, string message, SourceSpan span, int errorCode, Severity severity) { _source = source; _message = message; _span = span; _errorCode = errorCode; // _severity = severity; }
public void TrackTrace(string message, Severity severity, IDictionary<string, string> properties) { LogEventLevel level = LogEventLevel.Verbose; switch (severity) { case Severity.Off: return; case Severity.Error: level = LogEventLevel.Error; break; case Severity.Warning: level = LogEventLevel.Warning; break; case Severity.Verbose: case Severity.Verbose2: case Severity.Verbose3: level = LogEventLevel.Verbose; break; } if (_client.IsEnabled(level)) { var logProperties = new List<LogEventProperty>(); if (properties != null) logProperties.AddRange(properties.Select(x => new LogEventProperty(x.Key, new ScalarValue(x.Value)))); _client.Write(new LogEvent(DateTimeOffset.UtcNow, level, null, new MessageTemplate("{message}", new []{new TextToken(message)}), logProperties)); } }
public override void Add(string message, NewLineLocation[] lineLocations, int startIndex, int endIndex, int errorCode, Severity severity) { if (severity == Severity.Error || severity == Severity.FatalError) { _errors.Add(new ErrorResult(message, new SourceSpan(NewLineLocation.IndexToLocation(lineLocations, startIndex), NewLineLocation.IndexToLocation(lineLocations, endIndex)))); } else if (severity == Severity.Warning) { _warnings.Add(new ErrorResult(message, new SourceSpan(NewLineLocation.IndexToLocation(lineLocations, startIndex), NewLineLocation.IndexToLocation(lineLocations, endIndex)))); } }
private static void PreProcess(Severity severity, string additionalMessage, Exception exception) { var callStack = new StackTrace(1, true); var stackFrame = callStack.GetFrame(1); var log = new Log { MethodName = stackFrame.GetMethod().Name, ClassName = stackFrame.GetMethod().DeclaringType.Name, ApplicationName = stackFrame.GetMethod().DeclaringType.Assembly.GetName().Name, LineNumber = stackFrame.GetFileLineNumber(), Severity = (int)severity, Message = $"Message: {additionalMessage ?? ""}" }; if (exception.IsNotNull()) { log.Message += $" Exception: {(exception.IsNotNull() ? exception.ToString() : "")}"; } using (var ctx = new ApplicationDbContext()) { ctx.Logs.Add(log); ctx.SaveChanges(); } }
public FormatError(byte[] buffer, int ptr, Severity sev, String msg) { buf = buffer; offset = ptr; severity = sev; message = msg; }
private static void Log(Severity severity, string message) { if (_logAction != null) _logAction(severity, message); else Console.WriteLine($"{severity}: {message}"); }
public LogEntry(string message, Type sourceOfLogMessage, DateTime timestamp, Severity severity) { Message = message; SourceOfLogMessage = sourceOfLogMessage; Timestamp = timestamp; Severity = severity; }
public RuleAttribute(string key, Severity severity, string title, bool isActivatedByDefault) { Key = key; Title = title; Severity = severity; IsActivatedByDefault = isActivatedByDefault; }
protected override void LogMessageCore(string message, IDictionary<string, string> additionalData, Severity severity) { var output = WebUtility.HtmlEncode(message).Replace("\r\n", "<br />").Replace("\r", "<br />").Replace("\n", "<br />"); output = $"{dateTimeNowProvider.Now:yyyy-MM-dd HH:mm:ss}<br />" + output; mailerService.SendMail(recipientAddress, "Error Report", output); }
public LogMessage(string message, IContext context, Severity severity) { Message = message; Severity = severity; Context = context; Time = DateTime.Now; }
public override void AddError(string path, string message, string lineText, CodeSpan location, int errorCode, Severity severity) { // keep the error list under 100 items which is a reasonable number and avoids spending too much time on error processing if (Errors.Count < 100) { int startIndex, endIndex; if (location.StartLine > 0 && location.EndLine > 0) { // get the error bounds to create a span pointing to the error text so it can be navigated to later on by the Error List startIndex = textBuffer.CurrentSnapshot.GetLineFromLineNumber(location.StartLine - 1).Start.Position + location.StartColumn; endIndex = textBuffer.CurrentSnapshot.GetLineFromLineNumber(location.EndLine - 1).Start.Position + location.EndColumn; if (startIndex < endIndex && endIndex < textBuffer.CurrentSnapshot.GetText().Length) { // add the error with all its necessary information Errors.Add(new ValidationError(new Span(startIndex, endIndex - startIndex), message, GetSeverity(severity), ValidationErrorType.Syntactic)); if (Errors.Count == 100) { // add a friendly error telling the user the maximum number of errors has been reached Errors.Add(new ValidationError(new Span(startIndex, endIndex - startIndex), "The maximum number of errors or warnings has been reached.")); } } } } }
private static void Emit(Severity s, string format, params object[] args) { lock (_consolelock) { var color = Console.ForegroundColor; switch (s) { case Severity.information: // Console.ForegroundColor = ConsoleColor.White; break; case Severity.warning: Console.ForegroundColor = ConsoleColor.Yellow; break; case Severity.error: Console.ForegroundColor = ConsoleColor.Red; break; } var msg = string.Format(format, args); if (Debugger.IsAttached) { Debug.WriteLine(msg); } Console.WriteLine(msg); Console.ForegroundColor = color; } }
public void TrackTrace(string message, Severity severity) { switch (severity) { case Severity.Error: ConsoleText.WriteError(message); break; case Severity.Info: ConsoleText.WriteStatus(message); break; case Severity.Verbose: case Severity.Verbose2: case Severity.Verbose3: ConsoleText.WriteUsage(message); break; case Severity.Warning: ConsoleText.WriteWarning(message); break; case Severity.Off: return; default: TrackTrace(message); break; } }
public void Write(Severity sev, string msg) { if (_isOpen == false) { return; } StringBuilder sb = new StringBuilder(); sb.Append("["); if (sev == Severity.Debug) { sb.Append("D"); } else if (sev == Severity.Warning) { sb.Append("W"); } else if (sev == Severity.Error) { sb.Append("E"); } sb.Append("]"); sb.Append("["); sb.Append(DateTime.Now.ToString("dd/MM/yy HH:mm:ss")); sb.Append("] "); sb.Append(msg); string line = sb.ToString (); _logStream.WriteLine (line); #if DEBUG Console.WriteLine (line); #endif }
public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity) { base.Add(sourceUnit, message, span, errorCode, severity); Console.Error.WriteLine("{0}({1}:{2}): {3}: RB{4}: {5}", sourceUnit.Name, span.Start.Line, span.Start.Column, severity, errorCode, message); }
public static IStatusAppender Filtered(IStatusAppender baseAppender, Severity[] severities) { if (severities == null) { throw new ArgumentNullException("severities"); } // $NON-NLS-1 if (baseAppender == null || object.ReferenceEquals(baseAppender, StatusAppender.Null)) { return StatusAppender.Null; } else if (severities.Length == 0) { return StatusAppender.Null; } else { // 2^0 = 1 (None) // 2^1 = 2 (Error) // 2^2 = 4 (Warning) // 2^3 = 8 (Information) int result = 0; for (int i = 0; i < severities.Length; i++) { result &= (int) (Math.Pow(2, (int) severities[i])); if (result >= 2 + 4 + 8) { // all have been set or more return baseAppender; } } bool appendInfos = (result & 8) > 0; bool appendWarnings = (result & 4) > 0; bool appendErrors = (result & 2) > 0; return new FilteredStatusAppender(baseAppender, appendErrors, appendWarnings, appendInfos); } }
public AiReportOneObject(HitObjectBase h,int time, BeenCorrectedDelegate corrected, Severity severity, string information, int weblink) : base(time, severity, information, weblink, corrected) { this.h1 = h; RelatedHitObjects.Add(h); }
protected Item( Severity severity, string message, object targetItem ) { this.severity = severity; this.message = message ?? string.Empty; this.targetItem = targetItem; }
private static void Log(string str, Severity sev) { string header = string.Empty; switch (sev) { case Severity.TRACE: header = "TT ##"; break; case Severity.INFO: header = "II ##"; break; case Severity.WARNING: header = "WW ##"; break; case Severity.ERROR: header = "EE ##"; break; case Severity.STEPIN: header = ">> ##"; break; case Severity.STEPOUT: header = "<< ##"; break; } Reporter.Log(header + str + Environment.NewLine); }
private List<ValidationIssue> ParseIssues(XContainer document, string rootName, string listName, string tagName, Severity severity) { var elements = from e in document.Descendants(_namespace + rootName) select e; var issues = new List<ValidationIssue>(); foreach (var element in elements) { foreach (var list in element.Descendants(_namespace + listName)) { foreach (var errorElement in list.Descendants(_namespace + tagName)) { var issue = new ValidationIssue { Severity = severity }; if (errorElement.Descendants(_namespace + "line").Any()) issue.Row = int.Parse(errorElement.Descendants(_namespace + "line").First().Value); if (errorElement.Descendants(_namespace + "col").Any()) issue.Column = int.Parse(errorElement.Descendants(_namespace + "col").First().Value); if (errorElement.Descendants(_namespace + "message").Any()) { issue.Title = errorElement.Descendants(_namespace + "message").First().Value; issue.MessageId = Encoding.UTF8.GetString(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(issue.Title))); } issues.Add(issue); } } } return issues; }
/// <summary> /// Log a message. The current logging level is used to determine /// if the message is appended to the configured appender /// or if it is ignored. /// </summary> /// <param name="category">The category to which this log statement belongs.</param> /// <param name="s">The severity of the logging message.</param> /// <param name="errorMsg">A concise description of the problem encountered.</param> /// <param name="args">Variable values that are to be captured with the logging statement.</param> public static void Log(Severity s, string errorMsg, params object[] args) { if (args != null && args.Length > 0) LogMessage(s, Format(s.ToString() + ": " + errorMsg, args), null); else LogMessage(s, errorMsg, null); }
public AiReportOneObject(HitObjectBase h, BeenCorrectedDelegate corrected, Severity severity, string information, int weblink, GameMode Mode = GameMode.All) : base(h.StartTime, severity, information, weblink, corrected, Mode) { this.h1 = h; RelatedHitObjects.Add(h); }
public SyntaxErrorException(string message, string path, string code, string line, SourceSpan span, int errorCode, Severity severity) : base(message) { ContractUtils.RequiresNotNull(message, nameof(message)); _span = span; _severity = severity; _errorCode = errorCode; _sourcePath = path; _sourceCode = code; _sourceLine = line; }
public override void AddError(string path, string message, string lineText, int startLine, int startColumn, int endLine, int endColumn, int errorCode, Severity severity) { compResults.Errors.Add(new CompilerError(path, startLine, startColumn, errorCode.ToString(), message)); throw new CompilerException(); }
/// <inheritdoc /> public void Log(Severity severity, string message) => _logger.Log(severity, message);
/// <inheritdoc /> public InspectableConsoleLog(Severity severity = Severity.Diagnostic, bool useShortLayout = true, bool printSeverity = false) : base(severity, useShortLayout, printSeverity) { }
public void TrackTrace(string message, Severity severityLevel, IDictionary <string, string> properties) { throw new NotImplementedException(); }
public virtual void Add(string message, SourceSpan span, int errorCode, Severity severity) { }
internal void Add(string message, SourceLocation startSourceLoc, SourceLocation endSourceLoc, int errorCode, Severity severity) => Add( message, new SourceSpan(startSourceLoc, endSourceLoc), errorCode, severity );
internal void Add(string message, NewLineLocation[] lineLocations, int startIndex, int endIndex, int errorCode, Severity severity) => Add( message, NewLineLocation.IndexToLocation(lineLocations, startIndex), NewLineLocation.IndexToLocation(lineLocations, endIndex), errorCode, severity );
/// <inheritdoc /> public void LogFormat(Severity severity, string messageFormat, params object[] messageArgs) => _logger.LogFormat(severity, messageFormat, messageArgs);
/// <summary> /// Initializes a new instance of the <see cref="RollingMemoryLog" /> class. /// </summary> /// <param name="severity">Logging severity to use.</param> public RollingMemoryLog(Severity severity) { CurrentSeverity = severity; }
private void Log(Severity severity, string message, params object[] args) { Log(severity, String.Format(message, args)); }
/// <summary> /// Generate LogContext structure based on executionContext and invocationInfo passed in. /// /// LogContext structure is used in log provider interface. /// </summary> /// <param name="executionContext"></param> /// <param name="invocationInfo"></param> /// <param name="severity"></param> /// <returns></returns> private static LogContext GetLogContext(ExecutionContext executionContext, InvocationInfo invocationInfo, Severity severity) { if (executionContext == null) { return(null); } LogContext logContext = new LogContext(); string shellId = executionContext.ShellID; logContext.ExecutionContext = executionContext; logContext.ShellId = shellId; logContext.Severity = severity.ToString(); if (executionContext.EngineHostInterface != null) { logContext.HostName = executionContext.EngineHostInterface.Name; logContext.HostVersion = executionContext.EngineHostInterface.Version.ToString(); logContext.HostId = (string)executionContext.EngineHostInterface.InstanceId.ToString(); } logContext.HostApplication = string.Join(" ", Environment.GetCommandLineArgs()); if (executionContext.CurrentRunspace != null) { logContext.EngineVersion = executionContext.CurrentRunspace.Version.ToString(); logContext.RunspaceId = executionContext.CurrentRunspace.InstanceId.ToString(); Pipeline currentPipeline = ((RunspaceBase)executionContext.CurrentRunspace).GetCurrentlyRunningPipeline(); if (currentPipeline != null) { logContext.PipelineId = currentPipeline.InstanceId.ToString(CultureInfo.CurrentCulture); } } logContext.SequenceNumber = NextSequenceNumber; try { if (executionContext.LogContextCache.User == null) { logContext.User = Environment.UserDomainName + "\\" + Environment.UserName; executionContext.LogContextCache.User = logContext.User; } else { logContext.User = executionContext.LogContextCache.User; } } catch (InvalidOperationException) { logContext.User = Logging.UnknownUserName; } System.Management.Automation.Remoting.PSSenderInfo psSenderInfo = executionContext.SessionState.PSVariable.GetValue("PSSenderInfo") as System.Management.Automation.Remoting.PSSenderInfo; if (psSenderInfo != null) { logContext.ConnectedUser = psSenderInfo.UserInfo.Identity.Name; } logContext.Time = DateTime.Now.ToString(CultureInfo.CurrentCulture); if (invocationInfo == null) { return(logContext); } logContext.ScriptName = invocationInfo.ScriptName; logContext.CommandLine = invocationInfo.Line; if (invocationInfo.MyCommand != null) { logContext.CommandName = invocationInfo.MyCommand.Name; logContext.CommandType = invocationInfo.MyCommand.CommandType.ToString(); switch (invocationInfo.MyCommand.CommandType) { case CommandTypes.Application: logContext.CommandPath = ((ApplicationInfo)invocationInfo.MyCommand).Path; break; case CommandTypes.ExternalScript: logContext.CommandPath = ((ExternalScriptInfo)invocationInfo.MyCommand).Path; break; } } return(logContext); }
public void Write(Severity level, object context, string format, params object[] args) { WriteCore(level, context, format.Localized(args)); }
public SyntaxErrorException(string message, SourceUnit sourceUnit, SourceSpan span, int errorCode, Severity severity) : base(message) { ContractUtils.RequiresNotNull(message, nameof(message)); _span = span; _severity = severity; _errorCode = errorCode; if (sourceUnit != null) { _sourcePath = sourceUnit.Path; try { _sourceCode = sourceUnit.GetCode(); _sourceLine = sourceUnit.GetCodeLine(Line); } catch (System.IO.IOException) { // could not get source code. } } }
public void Write(Severity level, object context, string format) { WriteCore(level, context, format.Localized()); }
/// <summary> /// This is a variation of LogEngineHealthEvent api to make eventid, additionalInfo and newEngineState /// optional. /// /// A default event id for engine health event will be used. /// </summary> /// <param name="executionContext"></param> /// <param name="exception"></param> /// <param name="severity"></param> internal static void LogEngineHealthEvent(ExecutionContext executionContext, Exception exception, Severity severity) { LogEngineHealthEvent(executionContext, 100, exception, severity, null); }
/// <summary>Always returns true.</summary> public bool IsEnabled(Severity type) { return(true); }
public void Write(Severity level, object context, string format, object arg0, object arg1 = null) { WriteCore(level, context, format.Localized(arg0, arg1)); }
public void Write(Severity type, object context, string format, object arg0, object arg1 = null) { WriteCore(type, context, Localize.Localized(format, arg0, arg1)); }
public bool IsEnabled(Severity level) { return(_isEnabled != null?_isEnabled(level) : true); }
/// <summary>Always returns false.</summary> public bool IsEnabled(Severity level) { return(false); }
public void Write(Severity type, object context, string format, params object[] args) { WriteCore(type, context, Localize.Localized(format, args)); }
public void Write(Severity level, object context, string format, object arg0, object arg1 = null) { Write(level, context, format); }
public void Write(Severity type, object context, string format) { WriteCore(type, context, Localize.Localized(format)); }
public void SetLogFileSeverity(Severity severity) { _fileLogSeverity = severity; }
public void Write(Severity level, object context, string format, params object[] args) { Write(level, context, format); }
/// <summary> /// Check if a given severity level is current enabled for tracing. /// </summary> public bool IsSeverityEnabled(Severity severity) { return(IsEnabled && severity >= Logger.CurrentSeverity); }
/// <summary>Always returns true.</summary> public bool IsEnabled(Severity level) { return(true); }
/// <summary> /// Trace operation completion. /// </summary> public void OperationFinished(string message, string operationName, string componentName, ResultBase result, TimeSpan duration, Severity successSeverity, OperationKind kind) { // Severity level for non-successful case is computed in the following way: // CriticalFailures -> Error // Non-critical errors during initialization -> Warning // Non-critical errors in all the other operations -> Info var severity = successSeverity; if (!result.Succeeded) { severity = result.IsCriticalFailure ? Severity.Error : (kind == OperationKind.Startup ? Severity.Warning : Severity.Info); } TraceMessage(severity, message); if (Logger is IOperationLogger operationLogger) { var operationResult = new OperationResult(message, operationName, componentName, statusFromResult(result), duration, kind, result.Exception); operationLogger.OperationFinished(operationResult); } OperationStatus statusFromResult(ResultBase resultBase) { if (resultBase.IsCriticalFailure) { return(OperationStatus.CriticalFailure); } else if (resultBase.IsCancelled) { return(OperationStatus.Cancelled); } else if (resultBase.HasException) { return(OperationStatus.Failure); } else { return(OperationStatus.Success); } } }
///<summary> /// Specifies custom severity that should be stored alongside the validation message when validation fails for this rule. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="TProperty"></typeparam> /// <param name="rule"></param> /// <param name="severity"></param> /// <returns></returns> public static IRuleBuilderOptions <T, TProperty> WithSeverity <T, TProperty>(this IRuleBuilderOptions <T, TProperty> rule, Severity severity) { return(rule.Configure(config => config.CurrentValidator.Options.Severity = severity)); }