Log
public class Log
A class of static members used by anyone who wants to log messages.
-
An instance of the logger. It should usually be the one and only reference of the
Loggerprotocol implementation in the system. This can be used in addition toswiftLogger, in which case log messages will be sent to both loggers.Declaration
Swift
public static var logger: Logger? { get set } -
Log a message for use when in verbose logging mode.
Declaration
Swift
public static func verbose(_ msg: @autoclosure () -> String, functionName: String = #function, lineNum: Int = #line, fileName: String = #file )Parameters
msgThe message to be logged.
functionNameThe name of the function invoking the logger API. Defaults to the name of the function invoking this function.
lineNumThe line in the source code of the function invoking the logger API. Defaults to the line of the function invoking this function.
fileNameThe file containing the source code of the function invoking the logger API. Defaults to the name of the file containing the function which invokes this function.
-
Log an informational message.
Declaration
Swift
public class func info(_ msg: @autoclosure () -> String, functionName: String = #function, lineNum: Int = #line, fileName: String = #file)Parameters
msgThe message to be logged.
functionNameThe name of the function invoking the logger API. Defaults to the name of the function invoking this function.
lineNumThe line in the source code of the function invoking the logger API. Defaults to the line of the function invoking this function.
fileNameThe file containing the source code of the function invoking the logger API. Defaults to the name of the file containing the function which invokes this function.
-
Log a warning message.
Declaration
Swift
public class func warning(_ msg: @autoclosure () -> String, functionName: String = #function, lineNum: Int = #line, fileName: String = #file)Parameters
msgThe message to be logged.
functionNameThe name of the function invoking the logger API. Defaults to the name of the function invoking this function.
lineNumThe line in the source code of the function invoking the logger API. Defaults to the line of the function invoking this function.
fileNameThe file containing the source code of the function invoking the logger API. Defaults to the name of the file containing the function which invokes this function.
-
Log an error message.
Declaration
Swift
public class func error(_ msg: @autoclosure () -> String, functionName: String = #function, lineNum: Int = #line, fileName: String = #file)Parameters
msgThe message to be logged.
functionNameThe name of the function invoking the logger API. Defaults to the name of the function invoking this function.
lineNumThe line in the source code of the function invoking the logger API. Defaults to the line of the function invoking this function.
fileNameThe file containing the source code of the function invoking the logger API. Defaults to the name of the file containing the function which invokes this function.
-
Log a debugging message.
Declaration
Swift
public class func debug(_ msg: @autoclosure () -> String, functionName: String = #function, lineNum: Int = #line, fileName: String = #file)Parameters
msgThe message to be logged.
functionNameThe name of the function invoking the logger API. Defaults to the name of the function invoking this function.
lineNumThe line in the source code of the function invoking the logger API. Defaults to the line of the function invoking this function.
fileNameThe file containing the source code of the function invoking the logger API. Defaults to the name of the file containing the function which invokes this function.
-
Log a message when entering a function.
Declaration
Swift
public class func entry(_ msg: @autoclosure () -> String, functionName: String = #function, lineNum: Int = #line, fileName: String = #file)Parameters
msgThe message to be logged.
functionNameThe name of the function invoking the logger API. Defaults to the name of the function invoking this function.
lineNumThe line in the source code of the function invoking the logger API. Defaults to the line of the function invoking this function.
fileNameThe file containing the source code of the function invoking the logger API. Defaults to the name of the file containing the function which invokes this function.
-
Log a message when exiting a function.
Declaration
Swift
public class func exit(_ msg: @autoclosure () -> String, functionName: String = #function, lineNum: Int = #line, fileName: String = #file)Parameters
msgThe message to be logged.
functionNameThe name of the function invoking the logger API. Defaults to the name of the function invoking this function.
lineNumThe line in the source code of the function invoking the logger API. Defaults to the line of the function invoking this function.
fileNameThe file containing the source code of the function invoking the logger API. Defaults to the name of the file containing the function which invokes this function.
-
Indicates if a message with a specified type (
LoggerMessageType) will be logged by some configured logger (i.e. will not be filtered out). This could be a Logger conforming to LoggerAPI, swift-log or both.Note that due to differences in the log levels defined by LoggerAPI and swift-log, their equivalence is mapped as follows:
LoggerAPI: swift-log: .error -> .error .warning -> .warning .info -> .notice .verbose -> .info .debug -> .debug .entry -> .trace .exit -> .traceFor example, a swift-log Logger configured to log at the
.noticelevel will log messages from LoggerAPI at a level of.infoor higher.Declaration
Swift
public class func isLogging(_ level: LoggerMessageType) -> BoolParameters
levelThe type of message (
LoggerMessageType).Return Value
A Boolean indicating whether a message of the specified type (
LoggerMessageType) will be logged.
View on GitHub
Log Class Reference