-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
512 additions
and
176 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
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
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
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
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
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,51 @@ | ||
// Note: code originally comes from https://stackoverflow.com/questions/50826394/how-to-print-tool-command-line-in-cake | ||
|
||
/// <summary> | ||
/// Temporary sets logging verbosity. | ||
/// </summary> | ||
/// <example> | ||
/// <code> | ||
/// // Temporary sets logging verbosity to Diagnostic. | ||
/// using(context.UseVerbosity(Verbosity.Diagnostic)) | ||
/// { | ||
/// context.DotNetCoreBuild(project, settings); | ||
/// } | ||
/// </code> | ||
/// </example> | ||
public static VerbosityChanger UseVerbosity(this ICakeContext context, Verbosity newVerbosity) => | ||
new VerbosityChanger(context.Log, newVerbosity); | ||
|
||
|
||
/// <summary> | ||
/// Temporary sets logging verbosity to Diagnostic. | ||
/// </summary> | ||
/// <example> | ||
/// <code> | ||
/// // Temporary sets logging verbosity to Diagnostic. | ||
/// using(context.UseDiagnosticVerbosity()) | ||
/// { | ||
/// context.DotNetCoreBuild(project, settings); | ||
/// } | ||
/// </code> | ||
/// </example> | ||
public static VerbosityChanger UseDiagnosticVerbosity(this ICakeContext context) => | ||
context.UseVerbosity(Verbosity.Diagnostic); | ||
|
||
/// <summary> | ||
/// Cake log verbosity changer. | ||
/// Restores old verbosity on Dispose. | ||
/// </summary> | ||
public class VerbosityChanger : IDisposable | ||
{ | ||
ICakeLog _log; | ||
Verbosity _oldVerbosity; | ||
|
||
public VerbosityChanger(ICakeLog log, Verbosity newVerbosity) | ||
{ | ||
_log = log; | ||
_oldVerbosity = log.Verbosity; | ||
_log.Verbosity = newVerbosity; | ||
} | ||
|
||
public void Dispose() => _log.Verbosity = _oldVerbosity; | ||
} |
Oops, something went wrong.