NSObject(Debugging) Category Reference

Declared in NSObject+Debugging.h

Overview

NSObject debugging extensions.

Provides a clean mechanism for an object to log any state changes, warnings or error messages to the console. The properties loggingEnabled and loggingName determine whether the logging will occur and how each log message will be prefixed, so that it is easy to differentiate between the logs of each object.

  loggingEnabled

Whether this object should be logging.

@property (nonatomic) BOOL loggingEnabled

Declared In

NSObject+Debugging.h

  loggingName

The name prefix to use when this object logs messages.

@property (nonatomic, nullable) NSString *loggingName

Declared In

NSObject+Debugging.h

– log:

Logs to the console the format and parameters, prefixed by the type and logging name of this object.

- (void)log:(nonnull NSString *)format, ...

Parameters

format

The format string.

...

The parameters to bind to the format string.

Declared In

NSObject+Debugging.h

– logAssert:format:

If the condition is false, it logs to the console the format and parameters, prefixed by the type and logging name of this object.

- (void)logAssert:(BOOL)condition format:(nonnull NSString *)format, ...

Parameters

condition

The condition to check.

format

The format string.

...

The parameters to bind to the format string.

Declared In

NSObject+Debugging.h

+ loggingEnabled

Whether logging is enabled for this class object.

+ (BOOL)loggingEnabled

Declared In

NSObject+Debugging.h

+ setLoggingEnabled:

Sets whether logging is enabled for this class object.

+ (void)setLoggingEnabled:(BOOL)loggingEnabled

Parameters

loggingEnabled

The value to set.

Declared In

NSObject+Debugging.h

+ log:

Logs to the console the format and parameters, prefixed by the type name.

+ (void)log:(nonnull NSString *)format, ...

Parameters

format

The format string.

...

The parameters to bind to the format string.

Declared In

NSObject+Debugging.h

+ logAssert:format:

If the condition is false, it logs to the console the format and parameters, prefixed by the type name.

+ (void)logAssert:(BOOL)condition format:(nonnull NSString *)format, ...

Parameters

condition

The condition to check.

format

The format string.

...

The parameters to bind to the format string.

Declared In

NSObject+Debugging.h