Logger

public class Logger

Important

This is a Public Preview API. It may be changed or removed at any time.

Lifecycle

  • Inits the Logger with default outputs: ConsoleOutput and FileOutput. File logs are stored for 2 weeks, after that being deleted.

    Declaration

    Swift

    public convenience init()
  • Inits the Loggerwith provided log outputs.

    Declaration

    Swift

    public init(outputs: [LoggerOutput])

    Parameters

    outputs

    The array of user defined LoggerOutputs

Public

  • Desired log level, default is .verbose

    Declaration

    Swift

    public var logLevel: LogLevel
  • Returns all available log’s file

    Declaration

    Swift

    public func logURLs() -> [URL]
  • Logs a message with an info level

    Declaration

    Swift

    public func info(file: String = #file, line: Int = #line, column: Int = #column, function: String = #function)

    Parameters

    items

    The items to log.

    file

    The file in which the log happens.

    line

    The line at which the log happens.

    column

    The column at which the log happens.

    function

    The function in which the log happens.

  • Logs a message with an info level

    Declaration

    Swift

    public func info(
        _ items: Any...,
        file: String = #file,
        line: Int = #line,
        column: Int = #column,
        function: String = #function
    )

    Parameters

    items

    The items to log.

    file

    The file in which the log happens.

    line

    The line at which the log happens.

    column

    The column at which the log happens.

    function

    The function in which the log happens.

  • Logs a message with an info level

    Declaration

    Swift

    public func verbose(file: String = #file, line: Int = #line, column: Int = #column, function: String = #function)

    Parameters

    items

    The items to log.

    file

    The file in which the log happens.

    line

    The line at which the log happens.

    column

    The column at which the log happens.

    function

    The function in which the log happens.

  • Logs a message with an verbose level

    Declaration

    Swift

    public func verbose(
        _ items: Any...,
        file: String = #file,
        line: Int = #line,
        column: Int = #column,
        function: String = #function
    )

    Parameters

    items

    The items to log.

    file

    The file in which the log happens.

    line

    The line at which the log happens.

    column

    The column at which the log happens.

    function

    The function in which the log happens.

  • Logs a message with an warning level

    Declaration

    Swift

    public func warning(
        _ items: Any...,
        file: String = #file,
        line: Int = #line,
        column: Int = #column,
        function: String = #function
    )

    Parameters

    items

    The items to log.

    file

    The file in which the log happens.

    line

    The line at which the log happens.

    column

    The column at which the log happens.

    function

    The function in which the log happens.

  • Logs a message with an error level

    Declaration

    Swift

    public func error(
        _ items: Any...,
        file: String = #file,
        line: Int = #line,
        column: Int = #column,
        function: String = #function
    )

    Parameters

    items

    The items to log.

    file

    The file in which the log happens.

    line

    The line at which the log happens.

    column

    The column at which the log happens.

    function

    The function in which the log happens.