Instance Methodswift-log 1.6.2Logging

log(level:_:metadata:source:file:function:line:)

Log a message passing the log level as a parameter.

Logging.swift:121
func log(level: Logger.Level, _ message: @autoclosure () -> Logger.Message, metadata: @autoclosure () -> Logger.Metadata? = nil, source: @autoclosure () -> String? = nil, file: String = #fileID, function: String = #function, line: UInt = #line)

Parameters

level

The log level to log message at. For the available log levels, see Logger.Level.

message

The message to be logged. message can be used with any string interpolation literal.

metadata

One-off metadata to attach to this log message.

source

The source this log messages originates from. Defaults to the module emitting the log message.

file

The file this log message originates from (there’s usually no need to pass it explicitly as it defaults to #fileID.

function

The function this log message originates from (there’s usually no need to pass it explicitly as it defaults to #function).

line

The line this log message originates from (there’s usually no need to pass it explicitly as it defaults to #line).

If the logLevel passed to this method is more severe than the Logger’s logLevel, it will be logged, otherwise nothing will happen.