Pode
Pode copied to clipboard
New Logging Features: Syslog and Restful Support
Recovered from #1335
Description:
This PR introduces new features to the Pode logging system, adding support for Syslog and Restful logging methods. The following new functions have been added:
- 'Enable-PodeGeneralLogging'
- 'Enable-PodeTraceLogging'
- 'Disable-PodeGeneralLogging'
- 'Disable-PodeTraceLogging'
- 'Enable-PodeLogging'
- 'Disable-PodeLogging'
- 'Clear-PodeLogging'
Additionally,
the New-PodeLoggingMethod function now supports two new type: Syslog
and Restful
.
Write-PodeLog now has been improved
New Features:
- Logging Runspace: Logging now operates in its own runspace for improved performance and isolation.
- Service Shutdown on Logging Failure: Logging failure can be configured to trigger a service shutdown.
- Configurable Max Logging Queue Size: A new configurable maximum logging queue size has been introduced, which can trigger an error if the queue size is exceeded.
- Multiple Logging Output Methods: It is now possible to assign multiple logging output methods to a specific logging configuration.
- Multiple Log Formats: The Enable-PodeRequestLogging function now supports multiple log formats: 'Extended', 'Common', 'Combined', 'JSON'.
- Configurable Log Date Format: The log date format is now configurable.
- Syslog Transport Methods: Syslog support includes TCP, UDP, and TLS transport methods.
- Switched the internal core structure from using an ArrayList with manual locking to the threadsafe System.Collections.Concurrent.ConcurrentQueue
Here is an example of how to configure multiple logging output methods:
$logging = @(
(New-PodeLoggingMethod -Terminal),
(New-PodeLoggingMethod -Syslog -Server 127.0.0.1 -Transport UDP -AsUTC -ISO8601 -FailureAction Report),
(New-PodeLoggingMethod -File -Name 'requests' -MaxDays 4)
)
$logging | Enable-PodeRequestLogging