myPosh_Write-Log ist ein PowerShell-Modul, das eine einfache und flexible Möglichkeit bietet, Log-Nachrichten in einer Datei zu speichern und optional auf der Konsole auszugeben. Es unterstützt verschiedene Schweregrade wie Information, Warning, Error und Debug.
- Speichert Log-Nachrichten in einer Datei unter
$env:SystemDrive\tmp\myPosh_Log. - Gibt Nachrichten optional farblich hervorgehoben auf der Konsole aus.
- Unterstützt verschiedene Schweregrade (
Information,Warning,Error,Debug). - Fügt automatisch Zeitstempel und Benutzernamen zu den Log-Einträgen hinzu.
- Fehlerbehandlung für das Erstellen von Verzeichnissen und Dateien integriert.
- Benutzerdefinierter Log-Pfad kann mit dem Parameter
-CustomLogPathangegeben werden. - Der Parameter
-Severityist verpflichtend. - Kann die installierte Modulversion mit der PowerShell Gallery vergleichen und auf Wunsch aktualisieren.
Write-Log -Message "Testnachricht" -Severity Error -console $true
Write-Log -Message "Testnachricht" -Severity Information -CustomLogPath "D:\Logs"
Get-myPoshWriteLogUpdate
Get-myPoshWriteLogUpdate -Update- Kopiere das Modul in ein Verzeichnis, das im
$env:PSModulePathenthalten ist. - Importiere das Modul mit:
Import-Module myPosh_Write-Log
- Alternative Installation:
Install-Module -Name myPosh_write-log -Force -Scope AllUsers -AllowClobber
- Name: Torben Inselmann
- E-Mail: support@inselmann.it
- GitHub: nox309
myPosh_Write-Log is a PowerShell module that provides a simple and flexible way to log messages to a file and optionally display them on the console. It supports various severity levels such as Information, Warning, Error, and Debug.
- Logs messages to a file located at
$env:SystemDrive\tmp\myPosh_Log. - Optionally displays messages on the console with color-coded severity levels.
- Supports various severity levels (
Information,Warning,Error,Debug). - Automatically adds timestamps and usernames to log entries.
- Includes error handling for directory and file creation.
- Allows specifying a custom log path using the
-CustomLogPathparameter. - The
-Severityparameter is mandatory. - Can compare the installed module version with the PowerShell Gallery and optionally update it.
Write-Log -Message "Test message" -Severity Error -console $true
Write-Log -Message "Test message" -Severity Information -CustomLogPath "D:\Logs"
Get-myPoshWriteLogUpdate
Get-myPoshWriteLogUpdate -Update- Copy the module to a directory included in
$env:PSModulePath. - Import the module using:
Import-Module myPosh_Write-Log
- Alternative Installation:
Install-Module -Name myPosh_write-log -Force -Scope AllUsers -AllowClobber
- Name: Torben Inselmann
- Email: support@inselmann.it
- GitHub: nox309