PTLogger
@interface PTLogger : NSObject
A helper class that outputs messages to the log console.
-
Initializes a newly created
PTLoggerinstance.Declaration
Objective-C
- (nonnull instancetype)init;Swift
init()Return Value
an initialized
PTLoggerinstance -
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
PTLogOutputLevelNonefor non-debug (release) builds andPTLogOutputLevelDebugfor debug builds.Declaration
Objective-C
@property (nonatomic) PTLogOutputLevel outputLevel;Swift
var outputLevel: PTLogger.OutputLevel { get set } -
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
messageTypeThe type of the log message
formatThe 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
messageTypeThe type of the log message
formatThe format-string for the log message
argumentsThe list of variadic arguments used by the format-string
-
Logs an error message.
The message is logged with the
PTLogMessageErrormessage type.Declaration
Objective-C
- (void)logErrorMessage:(nonnull NSString *)format, ...;Parameters
formatThe format-string for the log message
-
Logs a warning message.
The message is logged with the
PTLogMessageWarningmessage type.Declaration
Objective-C
- (void)logWarningMessage:(nonnull NSString *)format, ...;Parameters
formatThe format-string for the log message
-
Logs an informational message.
The message is logged with the
PTLogMessageInfomessage type.Declaration
Objective-C
- (void)logInfoMessage:(nonnull NSString *)format, ...;Parameters
formatThe format-string for the log message
-
Logs a debugging message.
The message is logged with the
PTLogMessageDebugmessage type.Declaration
Objective-C
- (void)logDebugMessage:(nonnull NSString *)format, ...;Parameters
formatThe format-string for the log message
-
Logs a tracing message.
The message is logged with the
PTLogMessageTracemessage type.Declaration
Objective-C
- (void)logTraceMessage:(nonnull NSString *)format, ...;Parameters
formatThe format-string for the log message
PTLogger Class Reference