Support for multiple Teams channels
Hi,
is there a way to send messages to multiple Teams channels? Maybe switch between channels? I tried to set the WebHook on demand, sending a message to a different channel, setting the WebHook back to original.
$secondchannel = "WEBHOOK URL"
$defaultchannel = (Get-LoggingTarget -Name Teams).WebHook
(Get-LoggingTarget -Name Teams).WebHook = $secondchannel
Write-Log -Message ....
(Get-LoggingTarget -Name Teams).WebHook = $defaultchannel
But since the logger is running in background, the messages are not send in time to the designated channel. So sometimes the WebHook value is set back to $defaultchannel, before the logger sends the message to Teams.
Also calling the Wait-Logging function before resetting the WebHook, is not working out reliably.
Maybe there is a proper way to work with different WebHook URLs.
Cheers!
@EsOsO Maybe we could extend the target addition to allow multiple targets to run at the same time. This could also allow to add file targets for different severity. (e.g. one failure log with smaller granularity)
In a first thought this could be implemented by simply adding an identifier parameter (optional) Current structure : EnabledTargets[Target.Name] Possible structure : EnabledTargets[Target.Name][Target.Identifier]
The identifier could then default to e.g. default, if no specific identifier is given. I think this is a pretty simple addition that would also solve #90
Seems fine to me. @tosoikea would you take care of implementing?