Back to Corkboard

CorkLog.h File Reference

Functions and constants for use with logging. More...


Defines

#define CorkLog(FORMAT_AND_VARARGS...)   CorkLog_(FORMAT_AND_VARARGS)
 Write a formatted string to the console.
#define CorkLogv(FORMAT, ARGLIST)   CorkLogv_(FORMAT, ARGLIST)
 Write a formatted string to the console.
#define CorkLogObject(ANOBJECT)   CorkLog(@"%@", [(ANOBJECT) description])
 Write the description of an Objective-C object to the console.

Variables

NSString *const CorkDidAppendStringToLogNotification


Detailed Description

Functions and constants for use with logging.

Attention:
This file disables the use of NSLog(), NSLogv(), CFShow(), and CFShowStr() to encourage the use of CorkLog() and CorkLogv() instead. If you would prefer to use those functions, you will need to define CORK_ALLOW_POISONED_SYMBOLS before importing <CorkCore/CorkCore.h>. The output of those functions is not routed through Corkboard's debugging and display systems.

The functions in the printf() family are intentionally not poisoned, but you should still avoid using any of them with Corkboard as they don't route through Corkboard's debugging and display systems.


Define Documentation

#define CorkLog ( FORMAT_AND_VARARGS...   )     CorkLog_(FORMAT_AND_VARARGS)

Write a formatted string to the console.

  • FORMAT_AND_VARARGS...: The format string (an NSString) followed by its arguments.
Returns:
The string that was written to the console.
CorkLog() is basically a wrapper for NSLog(). In the future, it may do more. Your code should prefer CorkLog() over NSLog() when logging information related to Corkboard.

CorkLog() is implemented as a macro instead of a function so that it can retrieve information about the calling function and environment for display on the console.

After writing the string to the console, this function posts the CorkDidAppendStringToLogNotification notification to the default notification center. The string is the notification's object.

Warning:
If the variadic arguments following the format string do not match what the format string defines, the action of CorkLog() is undefined.
See also:
CorkLogv()

CorkLogObject()

Since:
CorkCore 1.0

#define CorkLogObject ( ANOBJECT   )     CorkLog(@"%@", [(ANOBJECT) description])

Write the description of an Objective-C object to the console.

  • ANOBJECT: The object to describe.
Returns:
The string that was written to the console.
CorkLogObject() is provided for convenience and simply sends the -description message to ANOBJECT, then prints the returned string.

After writing the string to the console, this function posts the CorkDidAppendStringToLogNotification notification to the default notification center. The string is the notification's object.

See also:
CorkLog()

CorkLogv()

Since:
CorkCore 1.0

#define CorkLogv ( FORMAT,
ARGLIST   )     CorkLogv_(FORMAT, ARGLIST)

Write a formatted string to the console.

  • FORMAT: The format string (an NSString).
  • ARGLIST: The argument list (a va_list). ARLGIST must have already been started and not yet ended, and must currently refer to the first variadic argument in the list.
Returns:
The string that was written to the console.
CorkLogv() is basically a wrapper for NSLogv(). In the future, it may do more. Your code should prefer CorkLogv() over NSLogv() when logging information related to Corkboard.

CorkLogv() is implemented as a macro instead of a function so that it can retrieve information about the calling function and environment for display on the console.

After writing the string to the console, this function posts the CorkDidAppendStringToLogNotification notification to the default notification center. The string is the notification's object.

Warning:
If the variadic arguments represented by ARGLIST do not match what FORMAT defines, the action of CorkLogv() is undefined.
See also:
CorkLog()

CorkLogObject()

Since:
CorkCore 1.0


Variable Documentation

This notification is posted whenever CorkLog(), CorkLogv(), or CorkLogObject() is called. Its object is the formatted string that was logged. Its userInfo dictionary includes values for the file, line, and function (both mangled and pretty) where the logging call was made, under keys equivalent to their C constant names (__FILE__, __LINE__, __func__, and __PRETTY_FUNCTION__ respectively.)

Since:
CorkCore 1.0

CorkCore Framework Reference © 2008–2009 Ayluro, Inc. All rights reserved. Questions or comments? Contact us.