|
|
|
|
@ -36,66 +36,68 @@ namespace CppSharp
@@ -36,66 +36,68 @@ namespace CppSharp
|
|
|
|
|
void PopIndent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static class DiagnosticExtensions |
|
|
|
|
public static class Diagnostics |
|
|
|
|
{ |
|
|
|
|
public static void Debug(this IDiagnostics consumer, |
|
|
|
|
string msg, params object[] args) |
|
|
|
|
public static IDiagnostics Implementation { get; set; } = new ConsoleDiagnostics(); |
|
|
|
|
|
|
|
|
|
public static DiagnosticKind Level |
|
|
|
|
{ |
|
|
|
|
var diagInfo = new DiagnosticInfo |
|
|
|
|
get { return Implementation.Level; } |
|
|
|
|
set { Implementation.Level = value; } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void PushIndent(int level = 4) |
|
|
|
|
{ |
|
|
|
|
Kind = DiagnosticKind.Debug, |
|
|
|
|
Message = string.Format(msg, args) |
|
|
|
|
}; |
|
|
|
|
Implementation.PushIndent(level); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
consumer.Emit(diagInfo); |
|
|
|
|
public static void PopIndent() |
|
|
|
|
{ |
|
|
|
|
Implementation.PopIndent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void Message(this IDiagnostics consumer, |
|
|
|
|
string msg, params object[] args) |
|
|
|
|
public static void Debug(string msg, params object[] args) |
|
|
|
|
{ |
|
|
|
|
var diagInfo = new DiagnosticInfo |
|
|
|
|
{ |
|
|
|
|
Kind = DiagnosticKind.Message, |
|
|
|
|
Kind = DiagnosticKind.Debug, |
|
|
|
|
Message = string.Format(msg, args) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
consumer.Emit(diagInfo); |
|
|
|
|
Implementation.Emit(diagInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void Warning(this IDiagnostics consumer, |
|
|
|
|
string msg, params object[] args) |
|
|
|
|
public static void Message(string msg, params object[] args) |
|
|
|
|
{ |
|
|
|
|
var diagInfo = new DiagnosticInfo |
|
|
|
|
{ |
|
|
|
|
Kind = DiagnosticKind.Warning, |
|
|
|
|
Kind = DiagnosticKind.Message, |
|
|
|
|
Message = string.Format(msg, args) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
consumer.Emit(diagInfo); |
|
|
|
|
Implementation.Emit(diagInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void Error(this IDiagnostics consumer, |
|
|
|
|
string msg, params object[] args) |
|
|
|
|
public static void Warning(string msg, params object[] args) |
|
|
|
|
{ |
|
|
|
|
var diagInfo = new DiagnosticInfo |
|
|
|
|
{ |
|
|
|
|
Kind = DiagnosticKind.Error, |
|
|
|
|
Kind = DiagnosticKind.Warning, |
|
|
|
|
Message = string.Format(msg, args) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
consumer.Emit(diagInfo); |
|
|
|
|
Implementation.Emit(diagInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void Error(this IDiagnostics consumer, |
|
|
|
|
string msg) |
|
|
|
|
public static void Error(string msg, params object[] args) |
|
|
|
|
{ |
|
|
|
|
var diagInfo = new DiagnosticInfo |
|
|
|
|
{ |
|
|
|
|
Kind = DiagnosticKind.Error, |
|
|
|
|
Message = msg |
|
|
|
|
Message = string.Format(msg, args) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
consumer.Emit(diagInfo); |
|
|
|
|
Implementation.Emit(diagInfo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|