Logger

open class Logger

High-level class that handles logging

  • Enables the logger

    Declaration

    Swift

    open var enabled : Bool = true
  • Add an output destination to the logger

    Declaration

    Swift

    public class func add(destination: BaseDestination) -> Bool

    Parameters

    destination

    The OutputDestination to add to the logger

    Return Value

    Bool denoting success

  • Remove an output destination from the logger

    Declaration

    Swift

    public class func remove(destination: BaseDestination) -> Bool

    Parameters

    destination

    The OutputDestination to remove from the logger

    Return Value

    Bool denoting success

  • Allow the user to remove all destinations and start over

    Declaration

    Swift

    open class func removeAllDestinations()
  • Returns the amount of open destinations

    Declaration

    Swift

    open class func countDestinations() -> Int
  • Log unimportant information (Lowest Priority)

    Precondition

    At least 1 destination must be configured to Logger

    Declaration

    Swift

    public class func verbose(_ message: @autoclosure () -> Any, file: String = #file, function: String = #function, line: Int = #line)

    Parameters

    message

    The log message to display

    file

    The file where log was called

    function

    The function where log was called

    line

    The line number where log was called

  • Log something that will help with debugging (Low Priority)

    Precondition

    At least 1 destination must be configured to Logger

    Declaration

    Swift

    public class func debug(_ message: @autoclosure () -> Any, file: String = #file, function: String = #function, line: Int = #line)

    Parameters

    message

    The log message to display

    file

    The file where log was called

    function

    The function where log was called

    line

    The line number where log was called

  • Log something that is not an issue or error (Regular Priority)

    Precondition

    At least 1 destination must be configured to Logger

    Declaration

    Swift

    public class func info(_ message: @autoclosure () -> Any, file: String = #file, function: String = #function, line: Int = #line)

    Parameters

    message

    The log message to display

    file

    The file where log was called

    function

    The function where log was called

    line

    The line number where log was called

  • Log something that may lead to an error (High Priority)

    Precondition

    At least 1 destination must be configured to Logger

    Declaration

    Swift

    public class func warning(_ message: @autoclosure () -> Any, file: String = #file, function: String = #function, line: Int = #line)

    Parameters

    message

    The log message to display

    file

    The file where log was called

    function

    The function where log was called

    line

    The line number where log was called

  • Log an error. This is something that is fatal. (Highest Priority)

    Precondition

    At least 1 destination must be configured to Logger

    Declaration

    Swift

    public class func error(_ message: @autoclosure () -> Any, file: String = #file, function: String = #function, line: Int = #line)

    Parameters

    message

    The log message to display

    file

    The file where log was called

    function

    The function where log was called

    line

    The line number where log was called