Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

real-time file logging #44

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

theaquamarine
Copy link
Contributor

Log script operation in real time to files rather than waiting until the end and logging then ($Log object is still written to the log file at the end of the run).

Most of the changes in this pr are switching Write-Outputs for Write-Host where required.

@AndersRodland
Copy link
Owner

This is a great feature which I want to add, but it have conflicts that I need to resolve and test before I can merge it. Conflicts are a result of me merging your other pull request for cmtrace compatible logfiles.

Script is mostly using Write-Host, so stick with that.
Also `Write-Information`, but that's not used in the script and is
commented out, to avoid PowerShell version support issues.

A proxy is also crated for `Write-Verbose`, but this should probably be
behind some sort of log level flag.
The dump of `$Log` is no longer the first thing written to the logs, so
saying 'Client Health Check starting' doesn't make much sense.

Also simplifies some redundant logic.
From Process block to Begin block
The parameter's not used anywhere so just causes `$Xml` to be shadowed,
and since `$Xml` did not have a default, it's shadowed by `$null`,
resulting in strange behaviour from anything within `Out-Logfile`'s
scope that expects `$Xml` to be defined and populated with a config
file if `Out-Logfile` is called without `-Xml $xml`.

Decided to remove the parameter rather than default to `$script:xml` as
this seemed the clearer option.
@theaquamarine
Copy link
Contributor Author

That should sort all the conflicts, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants