Skip to content
Josh Wright edited this page Jan 14, 2021 · 4 revisions

Log

Convenience struct for logging logs of various levels to a default Logger. By default, this logger has label Alchemy.

public struct Log
Log.debug("Hello, world!")

You can set a custom default logger like so:

// In Application.setup...
Log.logger = Logger(label: "my_default_logger")

Properties

logger

The logger to which all logs will be logged. By default it's a logger with label Alchemy.

var logger

Methods

trace(_:metadata:)

Log a message with the Logger.Level.trace log level.

public static func trace(_ message: String, metadata: Logger.Metadata? = nil)

Parameters

  • message: the message to log.
  • metadata: any metadata (a typealias of [String: Logger.MetadataType]) to log.

debug(_:metadata:)

Log a message with the Logger.Level.trace log level.

public static func debug(_ message: String, metadata: Logger.Metadata? = nil)

Parameters

  • message: the message to log.
  • metadata: any metadata (a typealias of [String: Logger.MetadataType]) to log.

info(_:metadata:)

Log a message with the Logger.Level.info log level.

public static func info(_ message: String, metadata: Logger.Metadata? = nil)

Parameters

  • message: the message to log.
  • metadata: any metadata (a typealias of [String: Logger.MetadataType]) to log.

notice(_:metadata:)

Log a message with the Logger.Level.notice log level.

public static func notice(_ message: String, metadata: Logger.Metadata? = nil)

Parameters

  • message: the message to log.
  • metadata: any metadata (a typealias of [String: Logger.MetadataType]) to log.

warning(_:metadata:)

Log a message with the Logger.Level.warning log level.

public static func warning(_ message: String, metadata: Logger.Metadata? = nil)

Parameters

  • message: the message to log.
  • metadata: any metadata (a typealias of [String: Logger.MetadataType]) to log.

error(_:metadata:)

Log a message with the Logger.Level.error log level.

public static func error(_ message: String, metadata: Logger.Metadata? = nil)

Parameters

  • message: the message to log.
  • metadata: any metadata (a typealias of [String: Logger.MetadataType]) to log.

critical(_:metadata:)

Log a message with the Logger.Level.critical log level.

public static func critical(_ message: String, metadata: Logger.Metadata? = nil)

Parameters

  • message: the message to log.
  • metadata: any metadata (a typealias of [String: Logger.MetadataType]) to log.
Alchemy
Types
Protocols
Global Typealiases
Global Variables
Global Functions
Fusion
Types
Protocols
Papyrus
Types
Protocols
Clone this wiki locally