CFLogger

0.3


 CFLogger is a simple PowerShell Logger Class
 
 CFLogger writes the log to the console with color, and to a specified log file path
 
 Usage:

 Load Module:
 Using Module CFLogger

 Create an instance of the class:
 $myLogger = Initialize-CFLogger
 $myLogger = Initialize-CFLogger "WARN" "C:\users\john.doe\documents\myLogger.log"
 $myLogger =

 CFLogger is a simple PowerShell Logger Class
 
 CFLogger writes the log to the console with color, and to a specified log file path
 
 Usage:

 Load Module:
 Using Module CFLogger

 Create an instance of the class:
 $myLogger = Initialize-CFLogger
 $myLogger = Initialize-CFLogger "WARN" "C:\users\john.doe\documents\myLogger.log"
 $myLogger = [CFLogger]::new()
 $myLogger = [CFLogger]::new("WARN","C:\users\john.doe\documents\myLogger.log")

 Set Minimum Log Level (default is "TRACE"; options are "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"):
 $myLogger.MinErrorLevel = "WARN"

 Set Log File Path:
 $myLogger.LogFilePath = "C:\users\john.doe\documents\myLogger.log"

 Write Logs:
 $myLogger.Log("My Message")
 $myLogger.Log("My Message", "DEBUG")
 $myLogger.Log("My Message", "DEBUG", $myStackTraceString)
 $myLogger.LogTrace("My Message")
 $myLogger.LogTrace("My Message", $myStackTraceString)
 $myLogger.LogDebug("My Message")
 $myLogger.LogDebug("My Message", $myStackTraceString)
 $myLogger.LogInfo("My Message")
 $myLogger.LogInfo("My Message", $myStackTraceString)
 $myLogger.LogWarn("My Message")
 $myLogger.LogWarn("My Message", $myStackTraceString)
 $myLogger.LogError("My Message")
 $myLogger.LogError("My Message", $myStackTraceString)
 $myLogger.LogFatal("My Message")
 $myLogger.LogFatal("My Message", $myStackTraceString)
 
Show more

Minimum PowerShell version

5.0

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name CFLogger

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name CFLogger

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) Kevin Attard Compagno. All rights reserved.

Package Details

Author(s)

  • Kevin Attard Compagno

Functions

Initialize-CFLogger

Dependencies

This module has no dependencies.

FileList

Version History

Version Downloads Last updated
0.3 (current version) 52 1/3/2023
0.2 12 1/3/2023
0.1 9 1/3/2023