Log

@objc(FRDefulatLog)
public class Log : NSObject

Log is a class responsible for Logging functionalities of FRCore SDK. Log can also be used in the application layer which then be displayed through FRCore SDK, and through OSLog with FRCore SDK’s system label and LogLevel.

Note

By default, Log uses OSLog to display the log entry in the debug console, and in the log system of iOS; however, when OS_ACTIVITY_MODE is disabled in the environment variable, Log then uses default system print() method to display the log entry in the console only.

Property

  • Current SDK version. We hard code it here as currently there is no other way to get it dinamically when used with SPM

    Declaration

    Swift

    public static let sdkVersion: String

Method

  • Sets LogLevel

    Declaration

    Swift

    @objc
    public static func setLogLevel(_ logLevel: LogLevel)

    Parameters

    logLevel

    Designated LogLevel to be displayed

  • Sets Custom Logger

    Declaration

    Swift

    @objc
    public static func setCustomLogger(_ logger: FRLogger)

    Parameters

    logger

    Set logger will reset the logger to Custom Logger, Default Logger will be inactive

Log

  • Prints verbose log level message

    Declaration

    Swift

    public static func v(_ message: String, _ includeCallStack: Bool? = true, module: String? = nil, file: String = #file, line: Int = #line, function: String = #function)

    Parameters

    message

    Log message

    includeCallStack

    Boolean indicator whether to include call stack or not

    module

    String value of Module name

    file

    Filename that the message was logged

    line

    Line # in the File that the message was logged

    function

    Name of method that the message was logged

  • Prints information log level message

    Declaration

    Swift

    public static func i(_ message: String, _ includeCallStack: Bool? = true, module: String? = nil, file: String = #file, line: Int = #line, function: String = #function)

    Parameters

    message

    Log message

    includeCallStack

    Boolean indicator whether to include call stack or not

    module

    String value of Module name

    file

    Filename that the message was logged

    line

    Line # in the File that the message was logged

    function

    Name of method that the message was logged

  • Prints warning log level message

    Declaration

    Swift

    public static func w(_ message: String, _ includeCallStack: Bool? = true, module: String? = nil, file: String = #file, line: Int = #line, function: String = #function)

    Parameters

    message

    Log message

    includeCallStack

    Boolean indicator whether to include call stack or not

    module

    String value of Module name

    file

    Filename that the message was logged

    line

    Line # in the File that the message was logged

    function

    Name of method that the message was logged

  • Prints error log level message

    Declaration

    Swift

    public static func e(_ message: String, module: String? = nil, file: String = #file, line: Int = #line, function: String = #function)

    Parameters

    message

    Log message

    includeCallStack

    Boolean indicator whether to include call stack or not

    module

    String value of Module name

    file

    Filename that the message was logged

    line

    Line # in the File that the message was logged

    function

    Name of method that the message was logged