-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTesting_PSLog_v2.ps1
More file actions
82 lines (69 loc) · 2.12 KB
/
Testing_PSLog_v2.ps1
File metadata and controls
82 lines (69 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#Import-Module PSLog
#Import-Module "C:\Users\Adrian\Documents\Dev\PSLog"
Import-Module "$PSScriptRoot\PSLog"
Import-Module "$PSScriptRoot\TestingPSLog.psm1"
$PSDefaultParameterValues.Add('*Log*:Verbose', $true)
$PSDefaultParameterValues.Add('*LogInstance:Verbose', $true)
$PSDefaultParameterValues.Add('*HostLog:Verbose', $true)
$PSDefaultParameterValues.Add('*FileLog:Verbose', $true)
Start-HostLog
Write-Host ""
$MyLog1 = New-Log
Start-HostLog
Write-Host ""
$MyLog1 | Start-HostLog
Write-Host ""
New-Log | Start-HostLog -LogLevel Error
break
$MyLog2 = New-Log
$MyLog2 | Start-HostLog -LogLevel Error
#$MyLog1 | Start-HostLog
#$MyLog1, $MyLog2 | Start-HostLog
#$MyLogId = $MyLog1.Id
#Start-HostLog -Id $MyLogId
#Trace-Command -Name ParameterBinding -Expression { Get-Sugus | Start-HostLog } -PSHost
#Trace-Command -Name ParameterBinding -Expression { Start-HostLog -Id $MyLog.Id } -PSHost
#Start-FileLog -Path C:\Temp\logfileNew.log -Append:$true #-LogLevel Error
#Start-FileLog -Path C:\Temp\logfileNew.log
#Start-EmailLog
$Text = 'Lorem ipsum dolor sit amet'
#Write-Log -Message $Text -Severity Error
#Write-Log -Message $Text -Severity Error -Indicator Neutral
#Write-Log -Message $Text -Severity Error -Indicator Success
<#
$FilePath = "C:\this-does-not-exist.log"
try
{
Write-Log -Message "Get content from not existing file $FilePath" -Severity Information
Get-Content -Path $FilePath -ErrorAction Stop
}
catch
{
Write-Log -Severity Error -ErrorRecord $_
}
try
{
Write-Log -Message "Get content from not existing file $FilePath" -Severity Information
Get-Content -Path $FilePath -ErrorAction Stop
}
catch
{
Write-Log -Severity Error -Message "Oooops something went wrong" -ErrorRecord $_
}
try
{
Write-Log -Message "Get content from not existing file $FilePath" -Severity Information
Get-Content -Path $FilePath -ErrorAction Stop
}
catch
{
Write-Log -Severity Error -Message "Something went wrong, but no big deal" -Indicator Neutral
Write-Log -Severity Error -ErrorRecord $_ -Indent 1
}
#>
#LogTesterLong
#LogTester
#LogTesterSuperLong
#Stop-HostLog
#Stop-FileLog
#Invoke-Item C:\Temp\logfileNew.log