Skip to main content

Slack

Slack

Configuration options

OptionTypeMandatoryDefaultDescription
LevelStringNoDefault LevelDefines the lowest logging level to logged
FormatStringNoDefault FormatDefines a custom format for the target
WebHookStringYesN/ASets the Slack Webhook URI
ChannelStringNoN/AOverrides the default channel of the Webhook
BotNameStringNoN/AOverrides the default name of the bot

Example

> Add-LoggingTarget -Name Slack -Configuration @{
WebHook = 'https://hooks.slack.com/services/xxxx/xxxx/xxxxxxxxxx'
Channel = '#other-channel'
BotName = 'PoshLogging'
Level = 'ALERT'
Format = '[%{timestamp}] [%{level}] %{message}'
}