Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified PSFramework/bin/PSFramework.dll
Binary file not shown.
Binary file modified PSFramework/bin/PSFramework.pdb
Binary file not shown.
77 changes: 77 additions & 0 deletions PSFramework/bin/PSFramework.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions PSFramework/changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# CHANGELOG
## ???
- New: Configuration validation: Credential. Validates PSCredential objects.
- New: The most awesome Tab Completion for input properties _ever_ .
- Upd: Write-PSFMessage supports localized strings through the `-String` and `-StringValues` parameters
- Upd: Stop-PSFFunction supports localized strings through the `-String` and `-StringValues` parameters
- Upd: Test-PSFShouldProcess now supports ShouldProcess itself. This should help silence tests on commands reyling on it.
- Upd: Message component supports localized strings
- Upd: Logging component logs in separate language than localized messages to screen / userinteraction
- Upd: Logging - filesystem provider now has a configuration to enable better output information: `psframework.logging.filesystem.modernlog`
- Upd: Import-PSFLocalizedString now accepts wildcard path patterns that resovle to multiple files.
- Upd: Adding tab completion for `Register-PSFTeppArgumentCompleter`
- fix: Missing localization strings - Fix: Missing tab completion for modules that register localized strings
Expand Down
6 changes: 2 additions & 4 deletions PSFramework/internal/configurations/logging.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#region Setting the configuration
Set-PSFConfig -Module PSFramework -Name 'Logging.MaxErrorCount' -Value 128 -Initialize -Validation "integerpositive" -Handler { [PSFramework.Message.LogHost]::MaxErrorCount = $args[0] } -Description "The maximum number of error records maintained in-memory. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately."
Set-PSFConfig -Module PSFramework -Name 'Logging.MaxErrorCount' -Value 128 -Initialize -Validation "integerpositive" -Handler { [PSFramework.Message.LogHost]::MaxErrorCount = $args[0] } -Description "The maximum number of error records maintained in-memory. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately."
Set-PSFConfig -Module PSFramework -Name 'Logging.MaxMessageCount' -Value 1024 -Initialize -Validation "integerpositive" -Handler { [PSFramework.Message.LogHost]::MaxMessageCount = $args[0] } -Description "The maximum number of messages that can be maintained in the in-memory message queue. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately."
Set-PSFConfig -Module PSFramework -Name 'Logging.MessageLogEnabled' -Value $true -Initialize -Validation "bool" -Handler { [PSFramework.Message.LogHost]::MessageLogEnabled = $args[0] } -Description "Governs, whether a log of recent messages is kept in memory. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately."
Set-PSFConfig -Module PSFramework -Name 'Logging.ErrorLogEnabled' -Value $true -Initialize -Validation "bool" -Handler { [PSFramework.Message.LogHost]::ErrorLogEnabled = $args[0] } -Description "Governs, whether a log of recent errors is kept in memory. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately."
Set-PSFConfig -Module PSFramework -Name 'Logging.DisableLogFlush' -Value $false -Initialize -Validation "bool" -Handler { } -Description "When shutting down the process, PSFramework will by default flush the log. This ensures that all events are properly logged. If this is not desired, it can be turned off with this setting."
#endregion Setting the configuration
Set-PSFConfig -Module PSFramework -Name 'Logging.DisableLogFlush' -Value $false -Initialize -Validation "bool" -Handler { } -Description "When shutting down the process, PSFramework will by default flush the log. This ensures that all events are properly logged. If this is not desired, it can be turned off with this setting."
11 changes: 10 additions & 1 deletion PSFramework/internal/loggingProviders/filesystem.provider.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ $message_Event = {

if ($Message)
{
Add-Content -Path $filesystem_CurrentFile -Value (ConvertTo-Csv ($Message | Select-PSFObject ComputerName, Timestamp, Level, 'LogMessage as Message', Type, FunctionName, ModuleName, File, Line, @{ n = "Tags"; e = { $_.Tags -join "," } }, TargetObject, Runspace) -NoTypeInformation)[1]
if ([PSFramework.Message.LogHost]::FileSystemModernLog)
{
if (-not (Test-Path $filesystem_CurrentFile))
{
$Message | Select-PSFObject ComputerName, Username, Timestamp, Level, 'LogMessage as Message', Type, FunctionName, ModuleName, File, Line, @{ n = "Tags"; e = { $_.Tags -join "," } }, TargetObject, Runspace, @{ n = "Callstack"; e = { $_.CallStack.ToString().Split("`n") -join " þ "} } | Export-Csv -Path $filesystem_CurrentFile -NoTypeInformation
}
else { Add-Content -Path $filesystem_CurrentFile -Value (ConvertTo-Csv ($Message | Select-PSFObject ComputerName, Username, Timestamp, Level, 'LogMessage as Message', Type, FunctionName, ModuleName, File, Line, @{ n = "Tags"; e = { $_.Tags -join "," } }, TargetObject, Runspace, @{ n = "Callstack"; e = { $_.CallStack.ToString().Split("`n") -join " þ " } }) -NoTypeInformation)[1] }
}
else { Add-Content -Path $filesystem_CurrentFile -Value (ConvertTo-Csv ($Message | Select-PSFObject ComputerName, Timestamp, Level, 'LogMessage as Message', Type, FunctionName, ModuleName, File, Line, @{ n = "Tags"; e = { $_.Tags -join "," } }, TargetObject, Runspace) -NoTypeInformation)[1] }
}
}

Expand Down Expand Up @@ -209,6 +217,7 @@ $configuration_Settings = {
Set-PSFConfig -Module PSFramework -Name 'Logging.FileSystem.MaxLogFileAge' -Value (New-TimeSpan -Days 7) -Initialize -Validation "timespan" -Handler { [PSFramework.Message.LogHost]::MaxLogFileAge = $args[0] } -Description "Any logfile older than this will automatically be cleansed. This setting is global."
Set-PSFConfig -Module PSFramework -Name 'Logging.FileSystem.MessageLogFileEnabled' -Value $true -Initialize -Validation "bool" -Handler { [PSFramework.Message.LogHost]::MessageLogFileEnabled = $args[0] } -Description "Governs, whether a log file for the system messages is written. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately."
Set-PSFConfig -Module PSFramework -Name 'Logging.FileSystem.ErrorLogFileEnabled' -Value $true -Initialize -Validation "bool" -Handler { [PSFramework.Message.LogHost]::ErrorLogFileEnabled = $args[0] } -Description "Governs, whether log files for errors are written. This setting is on a per-Process basis. Runspaces share, jobs or other consoles counted separately."
Set-PSFConfig -Module PSFramework -Name 'Logging.FileSystem.ModernLog' -Value $false -Initialize -Validation "bool" -Handler { [PSFramework.Message.LogHost]::FileSystemModernLog = $args[0] } -Description "Enables the modern, more powereful version of the filesystem log, including headers and extra columns"
Set-PSFConfig -Module PSFramework -Name 'Logging.FileSystem.LogPath' -Value $script:path_Logging -Initialize -Validation "string" -Handler { [PSFramework.Message.LogHost]::LoggingPath = $args[0] } -Description "The path where the PSFramework writes all its logs and debugging information."

Set-PSFConfig -Module LoggingProvider -Name 'FileSystem.Enabled' -Value $true -Initialize -Validation "bool" -Handler { if ([PSFramework.Logging.ProviderHost]::Providers['filesystem']) { [PSFramework.Logging.ProviderHost]::Providers['filesystem'].Enabled = $args[0] } } -Description "Whether the logging provider should be enabled on registration"
Expand Down
5 changes: 4 additions & 1 deletion PSFramework/internal/scripts/postimport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ foreach ($file in (Get-ChildItem -Path "$($script:ModuleRoot)\internal\parameter
# Register the unimport reaction
. Import-ModuleFile -Path "$($script:ModuleRoot)\internal\scripts\removalEvent.ps1"

# Load specialvariables
# Load special variables
. Import-ModuleFile -Path "$($script:ModuleRoot)\internal\scripts\variables.ps1"

# Load resources for TEPP input completion
. Import-ModuleFile -Path "$($script:ModuleRoot)\internal\scripts\teppInputResources.ps1"

# Finally register the license
. Import-ModuleFile -Path "$($script:ModuleRoot)\internal\scripts\license.ps1"
80 changes: 80 additions & 0 deletions PSFramework/internal/scripts/teppInputResources.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[PSFramework.TabExpansion.TabExpansionHost]::InputCompletionTypeData['System.IO.FileInfo'] = @(
[PSCustomObject]@{
Name = 'PSChildName'
Type = ([type]'System.String')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSDrive'
Type = ([type]'System.Management.Automation.PSDriveInfo')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSIsContainer'
Type = ([type]'System.Boolean')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSParentPath'
Type = ([type]'System.String')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSPath'
Type = ([type]'System.String')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSProvider'
Type = ([type]'System.Management.Automation.ProviderInfo')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'BaseName'
Type = ([type]'System.String')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'VersionInfo'
Type = ([type]'System.Diagnostics.FileVersionInfo')
TypeKnown = $true
}
)

[PSFramework.TabExpansion.TabExpansionHost]::InputCompletionTypeData['System.IO.DirectoryInfo'] = @(
[PSCustomObject]@{
Name = 'PSChildName'
Type = ([type]'System.String')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSDrive'
Type = ([type]'System.Management.Automation.PSDriveInfo')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSIsContainer'
Type = ([type]'System.Boolean')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSParentPath'
Type = ([type]'System.String')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSPath'
Type = ([type]'System.String')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'PSProvider'
Type = ([type]'System.Management.Automation.ProviderInfo')
TypeKnown = $true
},
[PSCustomObject]@{
Name = 'BaseName'
Type = ([type]'System.String')
TypeKnown = $true
}
)
Loading