NAME
Write-FileLog
SYNOPSIS
Saves log strings in a file.
SYNTAX
Write-FileLog [[-Type] <String>] [-String] <String[]> [-Path <String>] [<CommonParameters>]
DESCRIPTION
Function allow to create log string with timestamp at beginning in log files. New log files will be created each day with proper timestamp at beginning of filename. New entries will
be append to existing files.
PARAMETERS
-Type <String>
Specified what kind of entry it is: Info, Error or Warning
Required? false
Position? 2
Default value Info
Accept pipeline input? false
Accept wildcard characters? false
-String <String[]>
Set string which describes log entry:
Generic message, error description etc.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
Defines log files directory
Required? false
Position? named
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).
INPUTS
OUTPUTS
NOTES
Author : Sebastian Ziółkowski
Website: ziolkowsky.wordpress.com
GitHub : github.com/ziolkowsky
-------------------------- EXAMPLE 1 --------------------------
PS>Write-FileLog "This is info log entry test"
-------------------------- EXAMPLE 2 --------------------------
PS>Write-FileLog "This is warning log entry test" -Type Warning
-------------------------- EXAMPLE 3 --------------------------
PS>Write-FileLog "This is error log entry test" Error
RELATED LINKS
https://ziolkowsky.wordpress.com/2022/04/17/write-filelog
https://github.com/ziolkowsky/ShellPowerFramework
Dodaj komentarz