diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2021-07-25 00:16:59 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-09-02 15:12:15 -0500 |
commit | 1933df00138618c9004b6a6343e2f983df58bd3c (patch) | |
tree | 4b98f8b2c8e8006401e2f58018802d1242c82c47 /modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs | |
parent | b73e7623c82f27f6327922217ad72198223a7109 (diff) |
Some more C# formatting
Diffstat (limited to 'modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs')
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs index 9b7b422276..2bf1cb7a18 100644 --- a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs +++ b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs @@ -12,12 +12,16 @@ namespace GodotTools.BuildLogger public string Parameters { get; set; } public LoggerVerbosity Verbosity { get; set; } + private StreamWriter _logStreamWriter; + private StreamWriter _issuesStreamWriter; + private int _indent; + public void Initialize(IEventSource eventSource) { if (null == Parameters) throw new LoggerException("Log directory parameter not specified."); - var parameters = Parameters.Split(new[] { ';' }); + string[] parameters = Parameters.Split(new[] { ';' }); string logDir = parameters[0]; @@ -35,8 +39,8 @@ namespace GodotTools.BuildLogger if (!Directory.Exists(logDir)) Directory.CreateDirectory(logDir); - logStreamWriter = new StreamWriter(logFile); - issuesStreamWriter = new StreamWriter(issuesFile); + _logStreamWriter = new StreamWriter(logFile); + _issuesStreamWriter = new StreamWriter(issuesFile); } catch (Exception ex) { @@ -66,12 +70,12 @@ namespace GodotTools.BuildLogger private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) { WriteLine(e.Message); - indent++; + _indent++; } private void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e) { - indent--; + _indent--; WriteLine(e.Message); } @@ -87,7 +91,7 @@ namespace GodotTools.BuildLogger string errorLine = $@"error,{e.File.CsvEscape()},{e.LineNumber},{e.ColumnNumber}," + $"{e.Code?.CsvEscape() ?? string.Empty},{e.Message.CsvEscape()}," + $"{e.ProjectFile?.CsvEscape() ?? string.Empty}"; - issuesStreamWriter.WriteLine(errorLine); + _issuesStreamWriter.WriteLine(errorLine); } private void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) @@ -102,7 +106,7 @@ namespace GodotTools.BuildLogger string warningLine = $@"warning,{e.File.CsvEscape()},{e.LineNumber},{e.ColumnNumber}," + $"{e.Code?.CsvEscape() ?? string.Empty},{e.Message.CsvEscape()}," + $"{e.ProjectFile?.CsvEscape() ?? string.Empty}"; - issuesStreamWriter.WriteLine(warningLine); + _issuesStreamWriter.WriteLine(warningLine); } private void eventSource_MessageRaised(object sender, BuildMessageEventArgs e) @@ -136,28 +140,24 @@ namespace GodotTools.BuildLogger private void WriteLine(string line) { - for (int i = indent; i > 0; i--) + for (int i = _indent; i > 0; i--) { - logStreamWriter.Write("\t"); + _logStreamWriter.Write("\t"); } - logStreamWriter.WriteLine(line); + _logStreamWriter.WriteLine(line); } public void Shutdown() { - logStreamWriter.Close(); - issuesStreamWriter.Close(); + _logStreamWriter.Close(); + _issuesStreamWriter.Close(); } private bool IsVerbosityAtLeast(LoggerVerbosity checkVerbosity) { return Verbosity >= checkVerbosity; } - - private StreamWriter logStreamWriter; - private StreamWriter issuesStreamWriter; - private int indent; } internal static class StringExtensions |