Alek Davis
Alek Davis

Reputation: 10720

Is there a PowerShell logging module that uses StreamWriter to write to a text file?

I checked a dozen logging modules published at PowerShellGallery.com but every one of them uses a variation of the Write-Output or piping to Out-File approach which is really inefficient for bigger log files (every log command involves opening the file, reading to the end, and then writing an entry).

Before I write my own logging module, I am wondering if there is a more efficient version of a logging library that uses a StreamWriter.WriteLine approach. I only need to write to a console and/or a text file and I do not want to have any dependencies on the .NET code. Any ideas?

Upvotes: 2

Views: 135

Answers (1)

Alek Davis
Alek Davis

Reputation: 10720

Okay, since there seems to be no publicly available module that would do this, I wrote my own: StreamLogging. It can write to console and/or text file (it can also copy error messages to a separate error file). Documentation is at GitHub.

Upvotes: 1

Related Questions