コード例 #1
0
ファイル: Lager.cs プロジェクト: ScriptBox21/RainwayApp-bebop
 private string FormatSpanError(SpanException ex)
 {
     return(Formatter switch
     {
         LogFormatter.MSBuild => $"{ex.Span.FileName}({ex.Span.StartColonString(',')}) : error BOP{ex.ErrorCode}: {ex.Message}",
         LogFormatter.Structured => $"[{DateTime.Now}][Compiler][Error] Issue located in '{ex.Span.FileName}' at {ex.Span.StartColonString()}: {ex.Message}",
         LogFormatter.JSON => $@"{{""Message"": ""{ex.Message.EscapeString()}"", ""Span"": {ex.Span.ToJson()}}}",
         _ => throw new ArgumentOutOfRangeException()
     });
コード例 #2
0
 /// <summary>
 /// Format and write a <see cref="SpanException"/>
 /// </summary>
 private async Task WriteSpanError(SpanException ex)
 {
     var message = Formatter switch
     {
         LogFormatter.MSBuild => $"{ex.Span.FileName}({ex.Span.StartColonString(',')}) : error BOP{ex.ErrorCode}: {ex.Message}",
         LogFormatter.Structured => $"[{DateTime.Now}][Compiler][Error] Issue located in '{ex.Span.FileName}' at {ex.Span.StartColonString()}: {ex.Message}",
         LogFormatter.JSON => $@"{{""Message"": ""{ex.Message}"", ""Span"": {ex.Span.ToJson()}}}",
         _ => throw new ArgumentOutOfRangeException()
     };
     await Console.Error.WriteLineAsync(message).ConfigureAwait(false);
 }
コード例 #3
0
ファイル: Lager.cs プロジェクト: RainwayApp/bebop
 private string FormatSpanError(SpanException ex) =>
 FormatDiagnostic(new(ex.Severity, ex.Message, ex.ErrorCode, ex.Span));