diff --git a/PowerShell/Modules/TUN.Logging/TUN.Logging.md b/PowerShell/Modules/TUN.Logging/TUN.Logging.md
index 7c1fbcf..2652572 100644
--- a/PowerShell/Modules/TUN.Logging/TUN.Logging.md
+++ b/PowerShell/Modules/TUN.Logging/TUN.Logging.md
@@ -1,7 +1,7 @@
---
Module Name: TUN.Logging
Module Guid: eeac1534-25a5-4429-a073-17ec769525f5
-Module Version: 1.1.2
+Module Version: 1.1.4
Locale: en-US
---
@@ -15,7 +15,7 @@ Provides easy to use file and mail logging. Documentation of module at https://g
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/
## Module Metadata
-* Module version: 1.1.2
+* Module version: 1.1.4
* Module GUID: eeac1534-25a5-4429-a073-17ec769525f5
* Author: Markus Szumovski
* Company: ThingsUNeed
@@ -34,6 +34,8 @@ V 1.0.5: Bugfixes for logging from console or function, added logging of user
V 1.1.1: Bugfixing fallback color
V 1.1.2: Updated markdown help and added examples
+V 1.1.3: Changed output of error messages slightly to show more error details
+V 1.1.4: Bumped version number in markdown readme
### Required Modules
* TUN.Credentials (1.1.0)
diff --git a/PowerShell/Modules/TUN.Logging/TUN.Logging.psd1 b/PowerShell/Modules/TUN.Logging/TUN.Logging.psd1
index 1e3f117..eef4a0a 100644
--- a/PowerShell/Modules/TUN.Logging/TUN.Logging.psd1
+++ b/PowerShell/Modules/TUN.Logging/TUN.Logging.psd1
@@ -3,7 +3,7 @@
#
# Generated by: Markus Szumovski
#
-# Generated on: 29.01.2021
+# Generated on: 27.07.2023
#
@{
@@ -12,7 +12,7 @@
RootModule = 'TUN.Logging.psm1'
# Version number of this module.
-ModuleVersion = '1.1.2'
+ModuleVersion = '1.1.4'
# Supported PSEditions
# CompatiblePSEditions = @()
@@ -124,7 +124,9 @@ V 1.0.4: Bumped required module version
V 1.0.5: Bugfixes for logging from console or function, added logging of user
V 1.1.0: Bugfixes for Linux, now compatible with Linux Powershell Core
V 1.1.1: Bugfixing fallback color
-V 1.1.2: Updated markdown help and added examples'
+V 1.1.2: Updated markdown help and added examples
+V 1.1.3: Changed output of error messages slightly to show more error details
+V 1.1.4: Bumped version number in markdown readme'
# Prerelease string of this module
# Prerelease = ''
diff --git a/PowerShell/Modules/TUN.Logging/TUN.Logging.psm1 b/PowerShell/Modules/TUN.Logging/TUN.Logging.psm1
index 25215bc..2f47187 100644
--- a/PowerShell/Modules/TUN.Logging/TUN.Logging.psm1
+++ b/PowerShell/Modules/TUN.Logging/TUN.Logging.psm1
@@ -1841,8 +1841,16 @@ function Write-ErrorLog {
$strErrorMessage = ""
if($Err -and $Err.InvocationInfo -and !$NoErrorDetails.IsPresent) {
- $strErrorMessage += "`r`nScript: $($Err.InvocationInfo.ScriptName), Line: $($Err.InvocationInfo.ScriptLineNumber), Offset: $($Err.InvocationInfo.OffsetInLine)`r`n"
- $strErrorMessage += "`r`n$($Err.InvocationInfo.Line)`r`n"
+ if($null -ne $Err.ErrorDetails) {
+ if(![string]::IsNullOrWhiteSpace($Err.ErrorDetails.Message)) {
+ $strErrorMessage += "Error-Details: $($Err.ErrorDetails.Message);`r`n"
+ }
+ if(![string]::IsNullOrWhiteSpace($Err.ErrorDetails.RecommendedAction)) {
+ $strErrorMessage += "Recommended action: $($Err.ErrorDetails.RecommendedAction);`r`n"
+ }
+ }
+ $strErrorMessage += "`r`nScript: $($Err.InvocationInfo.ScriptName), Line: $($Err.InvocationInfo.ScriptLineNumber), Offset: $($Err.InvocationInfo.OffsetInLine);`r`n"
+ $strErrorMessage += "`r`n$($Err.InvocationInfo.Line);`r`n"
}
$strErrorMessage += $Message
@@ -1851,7 +1859,7 @@ function Write-ErrorLog {
}
if($Exception) {
- $strErrorMessage += "Error-Details: $($Exception.GetType().FullName), $($Exception.Message)" # - CategoryInfo: $($Err.CategoryInfo)"
+ $strErrorMessage += "Exception-Details: $($Exception.GetType().FullName), $($Exception.Message);" # - CategoryInfo: $($Err.CategoryInfo)"
}
#and now let's send the error message to the error stream
@@ -1859,7 +1867,7 @@ function Write-ErrorLog {
if(!$NoOut.IsPresent) {
Write-Error $strErrorMessage -Category $Category -ErrorId $Err.FullyQualifiedErrorId
}
- $strErrorMessage = ($strErrorMessage + " (Err-Category: $Category, Err-Id: $($Err.FullyQualifiedErrorId))")
+ $strErrorMessage = ($strErrorMessage + " (Err-Category: $Category, Err-Id: $($Err.FullyQualifiedErrorId));")
Write-Log -NoLog:$NoLog -AddTimestamp:$AddTimestamp -Force:$Force -IsError -Message $strErrorMessage
Write-MailLog -NoMail:$NoMail -Force:$ForceMail -IsError -Message $strErrorMessage
}
@@ -1867,7 +1875,7 @@ function Write-ErrorLog {
if(!$NoOut.IsPresent) {
Write-Error $strErrorMessage -Category $Category
}
- $strErrorMessage = ($strErrorMessage + " (Err-Category: $Category)")
+ $strErrorMessage = ($strErrorMessage + " (Err-Category: $Category);")
Write-Log -NoLog:$NoLog -AddTimestamp:$AddTimestamp -Force:$Force -IsError -Message $strErrorMessage
Write-MailLog -NoMail:$NoMail -Force:$ForceMail -IsError -Message $strErrorMessage
}