-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9018e13
commit 0aa64d0
Showing
9 changed files
with
591 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,123 @@ | ||
# Hobo.Log | ||
# Hobo.Log | ||
|
||
A collection of logging tools for powershell | ||
|
||
**[Hobo.Log.Event](modules/Hobo.Log.Event/README.md)**: Write to the Windows Event Log | ||
|
||
**[Hobo.Log.File](modules/Hobo.Log.File/README.md)**: Write to a file-based log | ||
|
||
**[Hobo.Log.Output](modules/Hobo.Log.Output/README.md)**: Write output to the console with standardized formatting | ||
|
||
## Write-LogTee | ||
``` | ||
NAME | ||
Write-LogTee | ||
SYNOPSIS | ||
This is a Powershell cmdlet to write output to the console, a log file, or the Windows Event Log with one command. | ||
SYNTAX | ||
Write-LogTee [-Message] <String> [[-LogType] <String>] [[-LogOutputPref] <Hashtable>] [[-LogOutputPipeline] <String>] [-LogOutputRaw] [-LogFile] [[-LogFilePref] <Hashtable>] [-LogFileRaw] [-LogEvent] [[-LogEventPref] <Hashtable>] [<CommonParameters>] | ||
DESCRIPTION | ||
This cmdlet allows a user to write output to the console using their preferred output pipeline, as well as write the output to a file log and the Windows Event Log at the same time with one command. | ||
PARAMETERS | ||
-Message <String> | ||
The message to be logged | ||
Required? true | ||
Position? 1 | ||
Default value | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogType <String> | ||
The event type of the log entry being written. (INFO, WARN, ERROR) | ||
Required? false | ||
Position? 2 | ||
Default value INFO | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogOutputPref <Hashtable> | ||
Required? false | ||
Position? 3 | ||
Default value @{} | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogOutputPipeline <String> | ||
Choose to write to alternative pipelines (OUTPUT, INFO) | ||
Required? false | ||
Position? 4 | ||
Default value OUTPUT | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogOutputRaw [<SwitchParameter>] | ||
Writes a string to console output instead of a LogOutput object | ||
Required? false | ||
Position? named | ||
Default value False | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogFile [<SwitchParameter>] | ||
Enables writing to the file log. | ||
Required? false | ||
Position? named | ||
Default value False | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogFilePref <Hashtable> | ||
A hashtable of parameters to be sent to the Write-LogFile command. | ||
Required? false | ||
Position? 5 | ||
Default value @{} | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogFileRaw [<SwitchParameter>] | ||
Writes a string to file output instead of a LogOutput object | ||
Required? false | ||
Position? named | ||
Default value False | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogEvent [<SwitchParameter>] | ||
Enables writing to the Windows Event Log. | ||
Required? false | ||
Position? named | ||
Default value False | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogEventPref <Hashtable> | ||
A hashtable of parameters to be sent to the Write-LogEvent command. | ||
Required? false | ||
Position? 6 | ||
Default value @{} | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
<CommonParameters> | ||
This cmdlet supports the common parameters: Verbose, Debug, | ||
ErrorAction, ErrorVariable, WarningAction, WarningVariable, | ||
OutBuffer, PipelineVariable, and OutVariable. For more information, see | ||
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Hobo.Log.Event | ||
|
||
Write to Windows Event Viewer logs | ||
|
||
### Write-LogEvent | ||
``` | ||
NAME | ||
Write-LogEvent | ||
SYNOPSIS | ||
Write messages to the Windows Event Log. | ||
SYNTAX | ||
Write-LogEvent [-Message] <String> [-LogSource] <String> [[-LogName] <String>] [[-LogType] <String>] [[-EventId] <String>] [-PassThru] [<CommonParameters>] | ||
DESCRIPTION | ||
This is a Powershell cmdlet to write messages to the Windows Event Log. It will automatically attempt to create the defined event log and source if they do not already exist. | ||
PARAMETERS | ||
-Message <String> | ||
The message to be written to the log | ||
Required? true | ||
Position? 1 | ||
Default value | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogSource <String> | ||
The name of the log source to be written from. This will create the source in the event viewer if the user has administrative privileges. | ||
Required? true | ||
Position? 2 | ||
Default value | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogName <String> | ||
The name of the event log to be written to. Defaults to the Application log. | ||
Required? false | ||
Position? 3 | ||
Default value Application | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogType <String> | ||
The event type of the log entry being written. This can be Information, Warning, or Error. Defaults to Information. | ||
Required? false | ||
Position? 4 | ||
Default value INFO | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-EventId <String> | ||
The ID number of the event being written. Defaults to 0. | ||
Required? false | ||
Position? 5 | ||
Default value 0 | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-PassThru [<SwitchParameter>] | ||
Writes object to console output as well | ||
Required? false | ||
Position? named | ||
Default value False | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
<CommonParameters> | ||
This cmdlet supports the common parameters: Verbose, Debug, | ||
ErrorAction, ErrorVariable, WarningAction, WarningVariable, | ||
OutBuffer, PipelineVariable, and OutVariable. For more information, see | ||
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). | ||
``` | ||
|
||
### New-LogEventSource | ||
``` | ||
NAME | ||
New-LogEventSource | ||
SYNOPSIS | ||
Create a new log source in the Windows Event Log. | ||
SYNTAX | ||
New-LogEventSource [-LogName] <String> [-LogSource] <String> [-Force] [<CommonParameters>] | ||
DESCRIPTION | ||
This is a Powershell cmdlet to create a new log source in the Windows Event Log. This command requires the user have administrative privileges. | ||
PARAMETERS | ||
-LogName <String> | ||
The name of the log to create the source in. Will create a new log with the defined name if one does not already exist. | ||
Required? true | ||
Position? 1 | ||
Default value | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-LogSource <String> | ||
The name of the log source to create. | ||
Required? true | ||
Position? 2 | ||
Default value | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
-Force [<SwitchParameter>] | ||
This will remove the log source if it already exists before creating it. This does NOT bypass administrative privilege checks. | ||
Required? false | ||
Position? named | ||
Default value False | ||
Accept pipeline input? false | ||
Accept wildcard characters? false | ||
<CommonParameters> | ||
This cmdlet supports the common parameters: Verbose, Debug, | ||
ErrorAction, ErrorVariable, WarningAction, WarningVariable, | ||
OutBuffer, PipelineVariable, and OutVariable. For more information, see | ||
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). | ||
``` |
Oops, something went wrong.