Ability to override how psake's internal logging is handled #301
+290
−153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There is a new WriteOutput function, which is used throughout the psake code whenever messages need to be logged. The function simply passes the message and message type to an "outputHandler" script block, which can be overridden in psake-config. So you can override exactly how output is handled by overriding that outputHandler script block.
The default outputHandler script block further routes the output according to it's output type (warning, verbose, error, etc) to corresponding script blocks which can also be overridden by psake-config. So you also have the option of overriding how a single type of output is handled.
The default outputHandlers for each message type outputs the message exactly as it would have been prior to this new feature, so it is a non-breaking change.
Related Issue
#65
Motivation and Context
As described in the issue, if your psake build file uses a different method of logging to psake's internal logging method, it can be difficult to try and handle the messages from each consistently. This change allows you to make psake's internal logging more consistent with your own. You can even have psake's messages routed to your own custom functions.
How Has This Been Tested?
New spec files added to verify the basic functionality, that all of psake's internal logging uses the new WriteOutput function, and that it handles situations where the config items have been overridden with invalid values.
Screenshots (if appropriate):
Types of changes
Checklist: