|
<< Index >> |
FutureBasic |
NSLog | function | |
|
(
Possible Uses
FB's NSLog is most often used to display the contents of variables while debugging code.
NSLog is usually turned off for production deployment to prevent users from seeing the NSLog window; it also removes extra code and extra framework thus reducing the app's size.
To incorporate NSLog into an Xcode project, see: Make Xcode Project
Setting |
Description |
Date | Prefix message with the current date using a @"yyyy-MM-dd" format |
Time | Prefix message with the current time using a @"HH:mm:ss.SSS" format |
App name | Prefix message with the application name |
Process ID | Prefix message with the app's process ID |
Console | Forward message to Console.app |
Floating | Make NSLog window float above all other windows |
Hide on deactivate | Hide NSLog window when the app becomes inactive |
Font | Set default font and size |
Appearance | Set default appearance (System, Light, Dark) |
ⓘ | Display escape characters, string format specifiers and length modifiers |
Escape characters
Character |
Description |
\a | Alert - When appended to a message, displays a modal alert, pausing program execution. |
\b | Backspace - Suppresses the hard return, allowing the subsequent NSLog call to continue on the same line |
\n, \r | \n is a newline characer and \r is a return character |
\t | Tab |
\u | 4-digit unicode character |
\U | 8-digit unicode character |
\x | Hex |
\\ | Backslash |
\" | Double quote |
Ancillary functions
Function |
Description |
|
Displays the message in a modal alert, pausing program execution. This is similar to appending the '\a' escape sequence to the message |
|
This alternative to NSLogAlert requires a prepared |
|
Sets log text attributes. |
Clears the log window | |
Hides the log window. |
|
|
Prints a pascal string to the log |
|
When |
Call this function to display and animate an indeterminate circular progress indicator at the top right of the NSLog window titlebar. | |
Call this function to hide the circular progress indicator in the NSLog window titlebar. | |
Scrolls the log window to the top | |
|
Sets the log window background color. |
|
Sets the log text font. |
|
Set the log window frame. |
|
Sets the tab interval |
|
Sets the text alignment. Options are: NSTextAlignmentRight NSTextAlignmentCenter NSTextAlignmentJustified NSTextAlignmentNatural |
|
Sets the log text color. |
|
Sets the log window title. |
|
Shows the log window when it's been hidden with |
|
Returns the log text as a |
|
This alternative to NSLog requires a prepared |
|
Writes the log text to a URL. The returned BOOL indicates success or failure. |
Suppressing CocoaUI alerts
When CocoaUI alerts are suppressed (
), the alert message and info text are redirected to NSLog.
Note: suppressing CocoaUI alerts is not recommended for the release version of an app.
See also
Make Xcode Project; print (to window); String format specifiers