CFLogger.psd1
@{ # Script module or binary module file associated with this manifest. RootModule = 'CFLogger.psm1' # Version number of this module. ModuleVersion = '0.3' # ID used to uniquely identify this module GUID = '55510466-0cf6-4702-a698-e430cf2fb0b8' # Author of this module Author = 'Kevin Attard Compagno' # Company or vendor of this module CompanyName = 'Invicti' # Copyright statement for this module Copyright = '(c) Kevin Attard Compagno. All rights reserved.' # Description of the functionality provided by this module Description = ' 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) ' # Minimum version of the PowerShell engine required by this module PowerShellVersion = '5.0' } |