PTLogger


@interface PTLogger : NSObject

A helper class that outputs messages to the log console.

  • Initializes a newly created PTLogger instance.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()

    Return Value

    an initialized PTLogger instance

  • A default logger that can be used by any thread.

    Declaration

    Objective-C

    @property (class, nonatomic, strong, readonly) NS_SWIFT_NAME(shared) PTLogger *sharedLogger;

    Swift

    class var shared: PTLogger { get }
  • The log message output level that determines which messages should be processed and which should be ignored.

    The default value of this property is PTLogOutputLevelNone for non-debug (release) builds and PTLogOutputLevelDebug for debug builds.

    Declaration

    Objective-C

    @property (nonatomic) PTLogOutputLevel outputLevel;

    Swift

    var outputLevel: PTLogger.OutputLevel { get set }
  • tag

    An optional string tag to be added to each log message.

    The default value of this property is nil.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *tag;

    Swift

    var tag: String? { get set }
  • Logs a message of the specified type.

    Declaration

    Objective-C

    - (void)logMessageWithType:(PTLogMessageType)messageType
                        format:(nonnull NSString *)format, ...;

    Parameters

    messageType

    The type of the log message

    format

    The format-string for the log message

  • Logs a message of the specified type.

    Declaration

    Objective-C

    - (void)logMessageWithType:(PTLogMessageType)messageType
                        format:(nonnull NSString *)format
                     arguments:(va_list)arguments;

    Swift

    func logMessage(with messageType: PTLogger.MessageType, format: String, arguments: CVaListPointer)

    Parameters

    messageType

    The type of the log message

    format

    The format-string for the log message

    arguments

    The list of variadic arguments used by the format-string

  • Logs an error message.

    The message is logged with the PTLogMessageError message type.

    Declaration

    Objective-C

    - (void)logErrorMessage:(nonnull NSString *)format, ...;

    Parameters

    format

    The format-string for the log message

  • Logs a warning message.

    The message is logged with the PTLogMessageWarning message type.

    Declaration

    Objective-C

    - (void)logWarningMessage:(nonnull NSString *)format, ...;

    Parameters

    format

    The format-string for the log message

  • Logs an informational message.

    The message is logged with the PTLogMessageInfo message type.

    Declaration

    Objective-C

    - (void)logInfoMessage:(nonnull NSString *)format, ...;

    Parameters

    format

    The format-string for the log message

  • Logs a debugging message.

    The message is logged with the PTLogMessageDebug message type.

    Declaration

    Objective-C

    - (void)logDebugMessage:(nonnull NSString *)format, ...;

    Parameters

    format

    The format-string for the log message

  • Logs a tracing message.

    The message is logged with the PTLogMessageTrace message type.

    Declaration

    Objective-C

    - (void)logTraceMessage:(nonnull NSString *)format, ...;

    Parameters

    format

    The format-string for the log message