PowerShell Logging Module
PS.Logging is a PowerShell module designed to facilitate logging in PowerShell scripts and modules. It provides a simple and flexible way to log messages with different severity levels, making it easier to track and debug script execution.
- Supports multiple log levels (e.g., Info, Warning, Error)
- Easy integration with existing PowerShell scripts
- Lightweight and fast
To install the PS.Logging module, you can use the following PowerShell command:
Install-Module -Name PS.Logging -Scope CurrentUserAfter installation, import the module into your PowerShell session:
Import-Module PS.LoggingYou can start logging messages using the Write-Log cmdlet. Here are some examples:
Write-Header -Message "How to use Logging Examples"
# Log an informational message
Write-Info -Message "This is an informational message."
# Log a warning message
Write-Warn -Message "This is a warning message."
# Log an error message
Write-Err -Message "This is an error message."You can clone the repository using the following command:
git clone https://github.com/TirsvadScript/PS.Logging.gitThe module includes a suite of Pester tests to ensure functionality and reliability. To run the tests, use the following command:
try { powershell -NoProfile -NoLogo -Command "Import-Module Pester -ErrorAction SilentlyContinue; Invoke-Pester -Script .\logging.Tests.ps1 -OutputFormat NUnitXml -OutputFile test-results.xml" } finally { if ($?) { echo "bbb6c4dc03844c2986fd1ddfd0ceb545=$?" } else { echo "bbb6c4dc03844c2986fd1ddfd0ceb545=$?" } }Contributions are welcome. Please follow the guidelines in CONTRIBUTING.md and open issues or pull requests.
See CONTRIBUTING.md
- Go to the Issues page: GitHub Issues
- Click "New Issue" and provide steps to reproduce, expected behavior, actual behavior, environment, and attachments (logs/screenshots).
Distributed under the AGPL-3.0 License. See LICENSE.txt or license link.
Jens Tirsvad Nielsen - LinkedIn
Thanks to contributors and the open-source community.
