Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

myPosh_Write-Log

Beschreibung (Deutsch)

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.

Funktionen

  • 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 -CustomLogPath angegeben werden.
  • Der Parameter -Severity ist verpflichtend.
  • Kann die installierte Modulversion mit der PowerShell Gallery vergleichen und auf Wunsch aktualisieren.

Beispiel

Write-Log -Message "Testnachricht" -Severity Error -console $true
Write-Log -Message "Testnachricht" -Severity Information -CustomLogPath "D:\Logs"
Get-myPoshWriteLogUpdate
Get-myPoshWriteLogUpdate -Update

Installation

  1. Kopiere das Modul in ein Verzeichnis, das im $env:PSModulePath enthalten ist.
  2. Importiere das Modul mit:
    Import-Module myPosh_Write-Log
  3. Alternative Installation:
    Install-Module -Name myPosh_write-log -Force -Scope AllUsers -AllowClobber

Autor


Description (English)

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.

Features

  • 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 -CustomLogPath parameter.
  • The -Severity parameter is mandatory.
  • Can compare the installed module version with the PowerShell Gallery and optionally update it.

Example

Write-Log -Message "Test message" -Severity Error -console $true
Write-Log -Message "Test message" -Severity Information -CustomLogPath "D:\Logs"
Get-myPoshWriteLogUpdate
Get-myPoshWriteLogUpdate -Update

Installation

  1. Copy the module to a directory included in $env:PSModulePath.
  2. Import the module using:
    Import-Module myPosh_Write-Log
  3. Alternative Installation:
    Install-Module -Name myPosh_write-log -Force -Scope AllUsers -AllowClobber

Author

About

Powershell Log Function - part of myPosh Porjekt

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages