-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Console: Add option to write formatted output to stdout instead of mo…
…difying the file (#441) * Add console option to write to stdout instead of modifying the file * --write-to-stdout requires exactly one file * Cannot combine --passive and --write-to-stdout * refactor options checking * move to separate function * print all issues instead of stopping after the first discovered error * errors in Program are always printed to stderr * make separate Logger class to make it available in Program --------- Co-authored-by: Lysann Schlegel <[email protected]> Co-authored-by: Dave Grochocki <[email protected]>
- Loading branch information
1 parent
2f7fa4f
commit 7bfd446
Showing
4 changed files
with
94 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// © Xavalon. All rights reserved. | ||
|
||
namespace Xavalon.XamlStyler.Console | ||
{ | ||
public sealed class Logger | ||
{ | ||
private readonly System.IO.TextWriter writer; | ||
private readonly LogLevel level; | ||
|
||
public Logger(System.IO.TextWriter writer, LogLevel level) | ||
{ | ||
this.writer = writer; | ||
this.level = level; | ||
} | ||
|
||
public void Log(string line, LogLevel level = LogLevel.Default) | ||
{ | ||
if (level <= this.level) | ||
{ | ||
this.writer.WriteLine(line); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters