forked from jverkoey/nimbus
/
group___debugging-_tools.html
271 lines (239 loc) · 15.8 KB
/
group___debugging-_tools.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Nimbus: Debugging Tools</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-24278774-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="page">
<div style="position:relative">
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<a style="float: right;margin-right:20px;margin-top:20px" href='http://www.pledgie.com/campaigns/15519'><img alt='Click here to support Nimbus development and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/15519.png?skin_name=chrome' border='0' /></a>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Nimbus
 <span id="projectnumber">0.6.0 - <a href="http://github.com/jverkoey/nimbus">Nimbus is proudly hosted on Github</a></span>
</div>
<div id="projectbrief">An iOS framework whose growth is bounded by O(documentation).</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.4-20110629 -->
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('group___debugging-_tools.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#define-members">Defines</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">Debugging Tools</div> </div>
<div class="ingroups"><a class="el" href="group___nimbus_core.html">Nimbus Core</a></div></div>
<div class="contents">
<hr/><a name="details" id="details"></a><h2>Overview</h2>
<p>For inspecting code and writing to logs in debug builds. </p>
<p>Nearly all of the following macros will only do anything if the DEBUG macro is defined. The recommended way to enable the debug tools is to specify DEBUG in the "Preprocessor Macros" field in your application's Debug target settings. Be careful not to set this for your release or app store builds because this will enable code that may cause your app to be rejected.</p>
<h2>Debug Assertions</h2>
<p>Debug assertions are a lightweight "sanity check". They won't crash the app, nor will they be included in release builds. They <em>will</em> halt the app's execution when debugging so that you can inspect the values that caused the failure.</p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___debugging-_tools.html#ga13cc3ae82820ea8141bc319bcb76ab7f" title="Assertions that only fire when DEBUG is defined.">NIDASSERT</a>(statement);
</pre></div><p>If <em>statement</em> is false, the statement will be written to the log and if you are running in the simulator with a debugger attached, the app will break on the assertion line.</p>
<h2>Debug Logging</h2>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___debugging-_tools.html#ga74e1fbd5193e3020f3abf072dcd59f26" title="Only writes to the log when DEBUG is defined.">NIDPRINT</a>(<span class="stringliteral">@"formatted log text %d"</span>, param1);
</pre></div><p>Print the given formatted text to the log.</p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___debugging-_tools.html#gaa606f4ba1dd48de5e2fd679b7d8b22d8" title="Write the containing method's name to the log using NIDPRINT.">NIDPRINTMETHODNAME</a>();
</pre></div><p>Print the current method name to the log.</p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___debugging-_tools.html#ga2d769dcaac3915eea5b9860a40bd179a" title="Only writes to the log if condition is satisified.">NIDCONDITIONLOG</a>(statement, <span class="stringliteral">@"formatted log text %d"</span>, param1);
</pre></div><p>If statement is true, then the formatted text will be written to the log.</p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___debugging-_tools.html#gaf0d5ca9cb5bd5c57cfaee0b9a565bb84" title="Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_INFO.">NIDINFO</a>/<a class="code" href="group___debugging-_tools.html#gacc8f90bb05765e613bb0dbb16d372dfc" title="Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_WARNING.">NIDWARNING</a>/<a class="code" href="group___debugging-_tools.html#gab5d8a773517976d97335706474ae1317" title="Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_ERROR.">NIDERROR</a>(<span class="stringliteral">@"formatted log text %d"</span>, param1);
</pre></div><p>Will only write the formatted text to the log if NIMaxLogLevel is greater than the respective NID* method's log level. See below for log levels.</p>
<p>The default maximum log level is NILOGLEVEL_WARNING.</p>
<h3>Turning up the log level while the app is running</h3>
<p>NIMaxLogLevel is declared a non-const extern so that you can modify it at runtime. This can be helpful for turning logging on while the application is running.</p>
<div class="fragment"><pre class="fragment"> <a class="code" href="group___debugging-_tools.html#ga4772ce14310fecf30ed2bc36dfe7c505" title="The maximum log level to output for Nimbus debug logs.">NIMaxLogLevel</a> = NILOGLEVEL_INFO;
</pre></div> <table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#ga13cc3ae82820ea8141bc319bcb76ab7f">NIDASSERT</a>(xx)   { if (!(xx)) { NIDPRINT(@"NIDASSERT failed: %s", #xx); } } ((void)0)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#ga74e1fbd5193e3020f3abf072dcd59f26">NIDPRINT</a>(xx,...)   NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaa606f4ba1dd48de5e2fd679b7d8b22d8"></a><!-- doxytag: member="Debugging-Tools::NIDPRINTMETHODNAME" ref="gaa606f4ba1dd48de5e2fd679b7d8b22d8" args="()" -->
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#gaa606f4ba1dd48de5e2fd679b7d8b22d8">NIDPRINTMETHODNAME</a>()   NIDPRINT(@"%s", __PRETTY_FUNCTION__)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#ga2d769dcaac3915eea5b9860a40bd179a">NIDCONDITIONLOG</a>(condition, xx,...)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gab5d8a773517976d97335706474ae1317"></a><!-- doxytag: member="Debugging-Tools::NIDERROR" ref="gab5d8a773517976d97335706474ae1317" args="(xx,...)" -->
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#gab5d8a773517976d97335706474ae1317">NIDERROR</a>(xx,...)   NIDCONDITIONLOG((NILOGLEVEL_ERROR <= <a class="el" href="group___debugging-_tools.html#ga4772ce14310fecf30ed2bc36dfe7c505">NIMaxLogLevel</a>), xx, ##__VA_ARGS__)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gacc8f90bb05765e613bb0dbb16d372dfc"></a><!-- doxytag: member="Debugging-Tools::NIDWARNING" ref="gacc8f90bb05765e613bb0dbb16d372dfc" args="(xx,...)" -->
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#gacc8f90bb05765e613bb0dbb16d372dfc">NIDWARNING</a>(xx,...)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf0d5ca9cb5bd5c57cfaee0b9a565bb84"></a><!-- doxytag: member="Debugging-Tools::NIDINFO" ref="gaf0d5ca9cb5bd5c57cfaee0b9a565bb84" args="(xx,...)" -->
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#gaf0d5ca9cb5bd5c57cfaee0b9a565bb84">NIDINFO</a>(xx,...)   NIDCONDITIONLOG((NILOGLEVEL_INFO <= <a class="el" href="group___debugging-_tools.html#ga4772ce14310fecf30ed2bc36dfe7c505">NIMaxLogLevel</a>), xx, ##__VA_ARGS__)</td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">NSInteger </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#ga4772ce14310fecf30ed2bc36dfe7c505">NIMaxLogLevel</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">BOOL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___debugging-_tools.html#ga9b5abee5150b99d8ccce041099d44706">NIDebugAssertionsShouldBreak</a></td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ga13cc3ae82820ea8141bc319bcb76ab7f"></a><!-- doxytag: member="NIDebuggingTools.h::NIDASSERT" ref="ga13cc3ae82820ea8141bc319bcb76ab7f" args="(xx)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define NIDASSERT</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">xx</td><td>)</td>
<td>   { if (!(xx)) { NIDPRINT(@"NIDASSERT failed: %s", #xx); } } ((void)0)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Assertions that only fire when DEBUG is defined. </p>
<p>An assertion is like a programmatic breakpoint. Use it for sanity checks to save headache while writing your code. </p>
<p>Definition at line <a class="el" href="_n_i_debugging_tools_8h_source.html#l00105">105</a> of file <a class="el" href="_n_i_debugging_tools_8h_source.html">NIDebuggingTools.h</a>.</p>
</div>
</div>
<a class="anchor" id="ga74e1fbd5193e3020f3abf072dcd59f26"></a><!-- doxytag: member="NIDebuggingTools.h::NIDPRINT" ref="ga74e1fbd5193e3020f3abf072dcd59f26" args="(xx,...)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define NIDPRINT</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">xx, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>...</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>   NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Only writes to the log when DEBUG is defined. </p>
<p>This log method will always write to the log, regardless of log levels. It is used by all of the other logging methods in Nimbus' debugging library. </p>
<p>Definition at line <a class="el" href="_n_i_debugging_tools_8h_source.html#l00143">143</a> of file <a class="el" href="_n_i_debugging_tools_8h_source.html">NIDebuggingTools.h</a>.</p>
</div>
</div>
<a class="anchor" id="ga2d769dcaac3915eea5b9860a40bd179a"></a><!-- doxytag: member="NIDebuggingTools.h::NIDCONDITIONLOG" ref="ga2d769dcaac3915eea5b9860a40bd179a" args="(condition, xx,...)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define NIDCONDITIONLOG</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">condition, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">xx, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>...</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment">{ <span class="keywordflow">if</span> ((condition)) { <a class="code" href="group___debugging-_tools.html#ga74e1fbd5193e3020f3abf072dcd59f26" title="Only writes to the log when DEBUG is defined.">NIDPRINT</a>(xx, ##__VA_ARGS__); } \
} ((void)0)
</pre></div>
<p>Only writes to the log if condition is satisified. </p>
<p>This macro powers the level-based loggers. It can also be used for conditionally enabling families of logs. </p>
<p>Definition at line <a class="el" href="_n_i_debugging_tools_8h_source.html#l00160">160</a> of file <a class="el" href="_n_i_debugging_tools_8h_source.html">NIDebuggingTools.h</a>.</p>
</div>
</div>
<hr/><h2>Variable Documentation</h2>
<a class="anchor" id="ga4772ce14310fecf30ed2bc36dfe7c505"></a><!-- doxytag: member="NIDebuggingTools.h::NIMaxLogLevel" ref="ga4772ce14310fecf30ed2bc36dfe7c505" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">NSInteger <a class="el" href="group___debugging-_tools.html#ga4772ce14310fecf30ed2bc36dfe7c505">NIMaxLogLevel</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The maximum log level to output for <a class="el" href="interface_nimbus.html" title="The Nimbus state interface.">Nimbus</a> debug logs. </p>
<p>This value may be changed at run-time.</p>
<p>The default value is NILOGLEVEL_WARNING. </p>
<p>Definition at line <a class="el" href="_n_i_debugging_tools_8m_source.html#l00020">20</a> of file <a class="el" href="_n_i_debugging_tools_8m_source.html">NIDebuggingTools.m</a>.</p>
</div>
</div>
<a class="anchor" id="ga9b5abee5150b99d8ccce041099d44706"></a><!-- doxytag: member="NIDebuggingTools.h::NIDebugAssertionsShouldBreak" ref="ga9b5abee5150b99d8ccce041099d44706" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">BOOL <a class="el" href="group___debugging-_tools.html#ga9b5abee5150b99d8ccce041099d44706">NIDebugAssertionsShouldBreak</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Whether or not debug assertions should halt program execution like a breakpoint when they fail. </p>
<p>An example of when this is used is in unit tests, when failure cases are tested that will fire debug assertions.</p>
<p>The default value is YES. </p>
<p>Definition at line <a class="el" href="_n_i_debugging_tools_8m_source.html#l00021">21</a> of file <a class="el" href="_n_i_debugging_tools_8m_source.html">NIDebuggingTools.m</a>.</p>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
</div><!-- .fixedwidth -->
<span class="footer">Generated for Nimbus by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4-20110629 </span>
</ul>
</div>
</div> <!-- page -->
</body>
</html>