SlackLogHandler
public struct SlackLogHandler : LogHandler
SlackLogHandler is an implementation of LogHandler for sending
Logger output directly to Slack.
-
The global log level threshold that determines when to send log output to Slack. Defaults to
.critical.The
logLevelof an individualSlackLogHandleris ignored when this global log level is set to a higher level.Declaration
Swift
public static var globalLogLevelThreshold: Logger.Level -
The log label for the log handler.
Declaration
Swift
public var label: String -
The Slack integration’s webhook URL.
Declaration
Swift
public var webhookURL: URL -
Overrides the Slack integration’s default channel.
Declaration
Swift
public var channel: String? -
Overrides the Slack integration’s default username.
Declaration
Swift
public var username: String? -
Override the Slack integration’s default icon.
Declaration
Swift
public var icon: SlackLogHandler.Icon? -
The color scheme is used to determine the color of a Slack message for a log level.
Declaration
Swift
public var colorScheme: ColorScheme -
Declaration
Swift
public var logLevel: Logger.Level -
Declaration
Swift
public var metadata: Logger.Metadata -
Creates a
SlackLogHandlerfor sendingLoggeroutput directly to Slack.Declaration
Swift
public init(label: String, webhookURL: URL, channel: String? = nil, username: String? = nil, icon: Icon? = nil, colorScheme: ColorScheme = .default)Parameters
labelThe log label for the log handler.
webhookURLThe Slack integration’s webhook URL.
channelOverrides the Slack integration’s default channel.
usernameOverrides the Slack integration’s default username.
iconOverride the Slack integration’s default icon.
colorSchemeThe color scheme is used to determine the color of a Slack message for a log level.
-
Declaration
Swift
public subscript(metadataKey metadataKey: String) -> Logger.Metadata.Value? { get set } -
Declaration
Swift
public func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?, file: String, function: String, line: UInt) -
A color scheme is used to determine the color of a Slack message for a log level.
Declaration
Swift
public typealias ColorScheme = [Logger.Level : Color] -
Declaration
Swift
extension SlackLogHandler.ColorScheme -
A color represented by a hex string.
See moreDeclaration
Swift
public struct Color : ExpressibleByStringLiteral, CustomStringConvertible -
An icon for a Slack integration.
See moreDeclaration
Swift
public enum Icon
View on GitHub
SlackLogHandler Structure Reference