akaer 1.0.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,596 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Akaer::Logger
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (L)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Akaer.html" title="Akaer (module)">Akaer</a></span></span>
36
+ &raquo;
37
+ <span class="title">Logger</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Akaer::Logger
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Logger</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">Logger</li>
82
+
83
+ <li class="next">Akaer::Logger</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/akaer/logger.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+
105
+
106
+
107
+
108
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
109
+ <ul class="summary">
110
+
111
+ <li class="public ">
112
+ <span class="summary_signature">
113
+
114
+ <a href="#start_time-instance_method" title="#start_time (instance method)">- (Object) <strong>start_time</strong> </a>
115
+
116
+
117
+
118
+ </span>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute start_time.</p>
132
+ </div></span>
133
+
134
+ </li>
135
+
136
+
137
+ </ul>
138
+
139
+
140
+
141
+
142
+
143
+ <h2>
144
+ Class Method Summary
145
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
146
+ </h2>
147
+
148
+ <ul class="summary">
149
+
150
+ <li class="public ">
151
+ <span class="summary_signature">
152
+
153
+ <a href="#create-class_method" title="create (class method)">+ (Object) <strong>create</strong>(file, level = Logger::INFO, formatter = nil) </a>
154
+
155
+
156
+
157
+ </span>
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'></div></span>
168
+
169
+ </li>
170
+
171
+
172
+ <li class="public ">
173
+ <span class="summary_signature">
174
+
175
+ <a href="#default_file-class_method" title="default_file (class method)">+ (Object) <strong>default_file</strong> </a>
176
+
177
+
178
+
179
+ </span>
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <span class="summary_desc"><div class='inline'></div></span>
190
+
191
+ </li>
192
+
193
+
194
+ <li class="public ">
195
+ <span class="summary_signature">
196
+
197
+ <a href="#default_formatter-class_method" title="default_formatter (class method)">+ (Object) <strong>default_formatter</strong> </a>
198
+
199
+
200
+
201
+ </span>
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <span class="summary_desc"><div class='inline'></div></span>
212
+
213
+ </li>
214
+
215
+
216
+ <li class="public ">
217
+ <span class="summary_signature">
218
+
219
+ <a href="#get_real_file-class_method" title="get_real_file (class method)">+ (Object) <strong>get_real_file</strong>(file) </a>
220
+
221
+
222
+
223
+ </span>
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+ <span class="summary_desc"><div class='inline'></div></span>
234
+
235
+ </li>
236
+
237
+
238
+ <li class="public ">
239
+ <span class="summary_signature">
240
+
241
+ <a href="#start_time-class_method" title="start_time (class method)">+ (Object) <strong>start_time</strong> </a>
242
+
243
+
244
+
245
+ </span>
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+ <span class="summary_desc"><div class='inline'></div></span>
256
+
257
+ </li>
258
+
259
+
260
+ </ul>
261
+
262
+ <h2>
263
+ Instance Method Summary
264
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
265
+ </h2>
266
+
267
+ <ul class="summary">
268
+
269
+ <li class="public ">
270
+ <span class="summary_signature">
271
+
272
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Logger) <strong>initialize</strong>(logdev, shift_age = 0, shift_size = 1048576) </a>
273
+
274
+
275
+
276
+ </span>
277
+
278
+
279
+ <span class="note title constructor">constructor</span>
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+ <span class="summary_desc"><div class='inline'><p>A new instance of Logger.</p>
289
+ </div></span>
290
+
291
+ </li>
292
+
293
+
294
+ </ul>
295
+
296
+
297
+
298
+ <div id="constructor_details" class="method_details_list">
299
+ <h2>Constructor Details</h2>
300
+
301
+ <div class="method_details first">
302
+ <h3 class="signature first" id="initialize-instance_method">
303
+
304
+ - (<tt><span class='object_link'><a href="" title="Akaer::Logger (class)">Logger</a></span></tt>) <strong>initialize</strong>(logdev, shift_age = 0, shift_size = 1048576)
305
+
306
+
307
+
308
+
309
+
310
+ </h3><div class="docstring">
311
+ <div class="discussion">
312
+ <p>A new instance of Logger</p>
313
+
314
+
315
+ </div>
316
+ </div>
317
+ <div class="tags">
318
+
319
+
320
+ </div><table class="source_code">
321
+ <tr>
322
+ <td>
323
+ <pre class="lines">
324
+
325
+
326
+ 14
327
+ 15
328
+ 16</pre>
329
+ </td>
330
+ <td>
331
+ <pre class="code"><span class="info file"># File 'lib/akaer/logger.rb', line 14</span>
332
+
333
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_logdev'>logdev</span><span class='comma'>,</span> <span class='id identifier rubyid_shift_age'>shift_age</span> <span class='op'>=</span> <span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_shift_size'>shift_size</span> <span class='op'>=</span> <span class='int'>1048576</span><span class='rparen'>)</span>
334
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_logdev'>logdev</span><span class='comma'>,</span> <span class='id identifier rubyid_shift_age'>shift_age</span><span class='comma'>,</span> <span class='id identifier rubyid_shift_size'>shift_size</span><span class='rparen'>)</span>
335
+ <span class='kw'>end</span></pre>
336
+ </td>
337
+ </tr>
338
+ </table>
339
+ </div>
340
+
341
+ </div>
342
+
343
+ <div id="instance_attr_details" class="attr_details">
344
+ <h2>Instance Attribute Details</h2>
345
+
346
+
347
+ <span id="start_time=-instance_method"></span>
348
+ <div class="method_details first">
349
+ <h3 class="signature first" id="start_time-instance_method">
350
+
351
+ - (<tt>Object</tt>) <strong>start_time</strong>
352
+
353
+
354
+
355
+
356
+
357
+ </h3><div class="docstring">
358
+ <div class="discussion">
359
+ <p>Returns the value of attribute start_time</p>
360
+
361
+
362
+ </div>
363
+ </div>
364
+ <div class="tags">
365
+
366
+
367
+ </div><table class="source_code">
368
+ <tr>
369
+ <td>
370
+ <pre class="lines">
371
+
372
+
373
+ 12
374
+ 13
375
+ 14</pre>
376
+ </td>
377
+ <td>
378
+ <pre class="code"><span class="info file"># File 'lib/akaer/logger.rb', line 12</span>
379
+
380
+ <span class='kw'>def</span> <span class='id identifier rubyid_start_time'>start_time</span>
381
+ <span class='ivar'>@start_time</span>
382
+ <span class='kw'>end</span></pre>
383
+ </td>
384
+ </tr>
385
+ </table>
386
+ </div>
387
+
388
+ </div>
389
+
390
+
391
+ <div id="class_method_details" class="method_details_list">
392
+ <h2>Class Method Details</h2>
393
+
394
+
395
+ <div class="method_details first">
396
+ <h3 class="signature first" id="create-class_method">
397
+
398
+ + (<tt>Object</tt>) <strong>create</strong>(file, level = Logger::INFO, formatter = nil)
399
+
400
+
401
+
402
+
403
+
404
+ </h3><table class="source_code">
405
+ <tr>
406
+ <td>
407
+ <pre class="lines">
408
+
409
+
410
+ 18
411
+ 19
412
+ 20
413
+ 21
414
+ 22
415
+ 23</pre>
416
+ </td>
417
+ <td>
418
+ <pre class="code"><span class="info file"># File 'lib/akaer/logger.rb', line 18</span>
419
+
420
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_level'>level</span> <span class='op'>=</span> <span class='const'>Logger</span><span class='op'>::</span><span class='const'>INFO</span><span class='comma'>,</span> <span class='id identifier rubyid_formatter'>formatter</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
421
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span>
422
+ <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_level'>level</span> <span class='op'>=</span> <span class='id identifier rubyid_level'>level</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
423
+ <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_formatter'>formatter</span> <span class='op'>=</span> <span class='id identifier rubyid_formatter'>formatter</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_formatter'>default_formatter</span>
424
+ <span class='id identifier rubyid_rv'>rv</span>
425
+ <span class='kw'>end</span></pre>
426
+ </td>
427
+ </tr>
428
+ </table>
429
+ </div>
430
+
431
+ <div class="method_details ">
432
+ <h3 class="signature " id="default_file-class_method">
433
+
434
+ + (<tt>Object</tt>) <strong>default_file</strong>
435
+
436
+
437
+
438
+
439
+
440
+ </h3><table class="source_code">
441
+ <tr>
442
+ <td>
443
+ <pre class="lines">
444
+
445
+
446
+ 33
447
+ 34
448
+ 35</pre>
449
+ </td>
450
+ <td>
451
+ <pre class="code"><span class="info file"># File 'lib/akaer/logger.rb', line 33</span>
452
+
453
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_file'>default_file</span>
454
+ <span class='gvar'>$stdout</span>
455
+ <span class='kw'>end</span></pre>
456
+ </td>
457
+ </tr>
458
+ </table>
459
+ </div>
460
+
461
+ <div class="method_details ">
462
+ <h3 class="signature " id="default_formatter-class_method">
463
+
464
+ + (<tt>Object</tt>) <strong>default_formatter</strong>
465
+
466
+
467
+
468
+
469
+
470
+ </h3><table class="source_code">
471
+ <tr>
472
+ <td>
473
+ <pre class="lines">
474
+
475
+
476
+ 37
477
+ 38
478
+ 39
479
+ 40
480
+ 41
481
+ 42
482
+ 43
483
+ 44
484
+ 45
485
+ 46
486
+ 47
487
+ 48
488
+ 49
489
+ 50
490
+ 51
491
+ 52</pre>
492
+ </td>
493
+ <td>
494
+ <pre class="code"><span class="info file"># File 'lib/akaer/logger.rb', line 37</span>
495
+
496
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_formatter'>default_formatter</span>
497
+ <span class='const'>Proc</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_severity'>severity</span><span class='comma'>,</span> <span class='id identifier rubyid_datetime'>datetime</span><span class='comma'>,</span> <span class='id identifier rubyid_progname'>progname</span><span class='comma'>,</span> <span class='id identifier rubyid_msg'>msg</span><span class='op'>|</span>
498
+ <span class='id identifier rubyid_color'>color</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_severity'>severity</span>
499
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>DEBUG</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='symbol'>:cyan</span>
500
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INFO</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='symbol'>:green</span>
501
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>WARN</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='symbol'>:yellow</span>
502
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ERROR</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='symbol'>:red</span>
503
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>FATAL</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='symbol'>:magenta</span>
504
+ <span class='kw'>else</span> <span class='kw'>nil</span>
505
+ <span class='kw'>end</span>
506
+
507
+ <span class='id identifier rubyid_header'>header</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[%s T+%0.5f] %s:</span><span class='tstring_end'>&quot;</span></span> <span class='op'>%</span><span class='lbracket'>[</span><span class='id identifier rubyid_datetime'>datetime</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y/%b/%d %H:%M:%S</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='id identifier rubyid_datetime'>datetime</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start_time'>start_time</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='comma'>,</span> <span class='id identifier rubyid_severity'>severity</span><span class='period'>.</span><span class='id identifier rubyid_rjust'>rjust</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_bright'>bright</span>
508
+ <span class='id identifier rubyid_header'>header</span> <span class='op'>=</span> <span class='id identifier rubyid_header'>header</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
509
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%s %s\n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>%</span> <span class='lbracket'>[</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_msg'>msg</span><span class='rbracket'>]</span>
510
+ <span class='rbrace'>}</span>
511
+ <span class='kw'>end</span></pre>
512
+ </td>
513
+ </tr>
514
+ </table>
515
+ </div>
516
+
517
+ <div class="method_details ">
518
+ <h3 class="signature " id="get_real_file-class_method">
519
+
520
+ + (<tt>Object</tt>) <strong>get_real_file</strong>(file)
521
+
522
+
523
+
524
+
525
+
526
+ </h3><table class="source_code">
527
+ <tr>
528
+ <td>
529
+ <pre class="lines">
530
+
531
+
532
+ 25
533
+ 26
534
+ 27
535
+ 28
536
+ 29
537
+ 30
538
+ 31</pre>
539
+ </td>
540
+ <td>
541
+ <pre class="code"><span class="info file"># File 'lib/akaer/logger.rb', line 25</span>
542
+
543
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_real_file'>get_real_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
544
+ <span class='kw'>case</span> <span class='id identifier rubyid_file'>file</span>
545
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>STDOUT</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='gvar'>$stdout</span>
546
+ <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>STDERR</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>then</span> <span class='gvar'>$stderr</span>
547
+ <span class='kw'>else</span> <span class='id identifier rubyid_file'>file</span>
548
+ <span class='kw'>end</span>
549
+ <span class='kw'>end</span></pre>
550
+ </td>
551
+ </tr>
552
+ </table>
553
+ </div>
554
+
555
+ <div class="method_details ">
556
+ <h3 class="signature " id="start_time-class_method">
557
+
558
+ + (<tt>Object</tt>) <strong>start_time</strong>
559
+
560
+
561
+
562
+
563
+
564
+ </h3><table class="source_code">
565
+ <tr>
566
+ <td>
567
+ <pre class="lines">
568
+
569
+
570
+ 54
571
+ 55
572
+ 56</pre>
573
+ </td>
574
+ <td>
575
+ <pre class="code"><span class="info file"># File 'lib/akaer/logger.rb', line 54</span>
576
+
577
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start_time'>start_time</span>
578
+ <span class='ivar'>@start_time</span> <span class='op'>||=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
579
+ <span class='kw'>end</span></pre>
580
+ </td>
581
+ </tr>
582
+ </table>
583
+ </div>
584
+
585
+ </div>
586
+
587
+ </div>
588
+
589
+ <div id="footer">
590
+ Generated on Tue Jul 24 15:51:18 2012 by
591
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
592
+ 0.8.2.1 (ruby-1.9.2).
593
+ </div>
594
+
595
+ </body>
596
+ </html>