lumberjack 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/MIT_LICENSE +20 -0
  2. data/README.rdoc +86 -0
  3. data/Rakefile +56 -0
  4. data/VERSION +1 -0
  5. data/lib/lumberjack.rb +39 -0
  6. data/lib/lumberjack/device.rb +26 -0
  7. data/lib/lumberjack/device/date_rolling_log_file.rb +58 -0
  8. data/lib/lumberjack/device/log_file.rb +18 -0
  9. data/lib/lumberjack/device/null.rb +15 -0
  10. data/lib/lumberjack/device/rolling_log_file.rb +109 -0
  11. data/lib/lumberjack/device/size_rolling_log_file.rb +58 -0
  12. data/lib/lumberjack/device/writer.rb +119 -0
  13. data/lib/lumberjack/formatter.rb +76 -0
  14. data/lib/lumberjack/formatter/exception_formatter.rb +12 -0
  15. data/lib/lumberjack/formatter/inspect_formatter.rb +10 -0
  16. data/lib/lumberjack/formatter/pretty_print_formatter.rb +23 -0
  17. data/lib/lumberjack/formatter/string_formatter.rb +10 -0
  18. data/lib/lumberjack/log_entry.rb +36 -0
  19. data/lib/lumberjack/logger.rb +302 -0
  20. data/lib/lumberjack/rack.rb +5 -0
  21. data/lib/lumberjack/rack/unit_of_work.rb +15 -0
  22. data/lib/lumberjack/severity.rb +23 -0
  23. data/lib/lumberjack/template.rb +71 -0
  24. data/spec/device/date_rolling_log_file_spec.rb +66 -0
  25. data/spec/device/date_rolling_log_file_spec.rbc +2118 -0
  26. data/spec/device/log_file_spec.rb +26 -0
  27. data/spec/device/log_file_spec.rbc +727 -0
  28. data/spec/device/null_spec.rb +12 -0
  29. data/spec/device/null_spec.rbc +362 -0
  30. data/spec/device/rolling_log_file_spec.rb +117 -0
  31. data/spec/device/rolling_log_file_spec.rbc +2894 -0
  32. data/spec/device/size_rolling_log_file_spec.rb +54 -0
  33. data/spec/device/size_rolling_log_file_spec.rbc +1961 -0
  34. data/spec/device/stream_spec.rbc +3310 -0
  35. data/spec/device/writer_spec.rb +118 -0
  36. data/spec/entry_spec.rbc +2333 -0
  37. data/spec/formatter/exception_formatter_spec.rb +20 -0
  38. data/spec/formatter/exception_formatter_spec.rbc +620 -0
  39. data/spec/formatter/inspect_formatter_spec.rb +13 -0
  40. data/spec/formatter/inspect_formatter_spec.rbc +360 -0
  41. data/spec/formatter/pretty_print_formatter_spec.rb +14 -0
  42. data/spec/formatter/pretty_print_formatter_spec.rbc +380 -0
  43. data/spec/formatter/string_formatter_spec.rb +12 -0
  44. data/spec/formatter/string_formatter_spec.rbc +314 -0
  45. data/spec/formatter_spec.rb +45 -0
  46. data/spec/formatter_spec.rbc +1431 -0
  47. data/spec/log_entry_spec.rb +69 -0
  48. data/spec/logger_spec.rb +390 -0
  49. data/spec/logger_spec.rbc +10043 -0
  50. data/spec/lumberjack_spec.rb +22 -0
  51. data/spec/lumberjack_spec.rbc +523 -0
  52. data/spec/rack/unit_of_work_spec.rb +26 -0
  53. data/spec/rack/unit_of_work_spec.rbc +697 -0
  54. data/spec/severity_spec.rb +23 -0
  55. data/spec/spec_helper.rb +16 -0
  56. data/spec/spec_helper.rbc +391 -0
  57. data/spec/template_spec.rb +34 -0
  58. data/spec/template_spec.rbc +1563 -0
  59. data/spec/unique_identifier_spec.rbc +329 -0
  60. metadata +128 -0
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Lumberjack::Formatter::ExceptionFormatter do
4
+
5
+ it "should convert an exception without a backtrace to a string" do
6
+ e = ArgumentError.new("not expected")
7
+ formatter = Lumberjack::Formatter::ExceptionFormatter.new
8
+ formatter.call(e).should == "ArgumentError: not expected"
9
+ end
10
+
11
+ it "should convert an exception with a backtrace to a string" do
12
+ begin
13
+ raise ArgumentError.new("not expected")
14
+ rescue => e
15
+ formatter = Lumberjack::Formatter::ExceptionFormatter.new
16
+ formatter.call(e).should == "ArgumentError: not expected#{Lumberjack::LINE_SEPARATOR} #{e.backtrace.join(Lumberjack::LINE_SEPARATOR + ' ')}"
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,620 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 26
13
+ 5
14
+ 7
15
+ 0
16
+ 64
17
+ 47
18
+ 49
19
+ 1
20
+ 1
21
+ 15
22
+ 5
23
+ 45
24
+ 2
25
+ 3
26
+ 43
27
+ 4
28
+ 43
29
+ 5
30
+ 56
31
+ 6
32
+ 47
33
+ 50
34
+ 7
35
+ 1
36
+ 15
37
+ 2
38
+ 11
39
+ I
40
+ 3
41
+ I
42
+ 0
43
+ I
44
+ 0
45
+ I
46
+ 0
47
+ n
48
+ p
49
+ 8
50
+ s
51
+ 11
52
+ spec_helper
53
+ x
54
+ 7
55
+ require
56
+ x
57
+ 10
58
+ Lumberjack
59
+ n
60
+ x
61
+ 9
62
+ Formatter
63
+ x
64
+ 18
65
+ ExceptionFormatter
66
+ M
67
+ 1
68
+ p
69
+ 2
70
+ x
71
+ 9
72
+ for_block
73
+ t
74
+ n
75
+ x
76
+ 9
77
+ __block__
78
+ i
79
+ 22
80
+ 5
81
+ 7
82
+ 0
83
+ 64
84
+ 56
85
+ 1
86
+ 47
87
+ 50
88
+ 2
89
+ 1
90
+ 15
91
+ 5
92
+ 7
93
+ 3
94
+ 64
95
+ 56
96
+ 4
97
+ 47
98
+ 50
99
+ 2
100
+ 1
101
+ 11
102
+ I
103
+ 4
104
+ I
105
+ 0
106
+ I
107
+ 0
108
+ I
109
+ 0
110
+ I
111
+ -2
112
+ p
113
+ 5
114
+ s
115
+ 59
116
+ should convert an exception without a backtrace to a string
117
+ M
118
+ 1
119
+ p
120
+ 2
121
+ x
122
+ 9
123
+ for_block
124
+ t
125
+ n
126
+ x
127
+ 9
128
+ __block__
129
+ i
130
+ 80
131
+ 45
132
+ 0
133
+ 1
134
+ 13
135
+ 71
136
+ 2
137
+ 47
138
+ 9
139
+ 24
140
+ 47
141
+ 49
142
+ 3
143
+ 0
144
+ 13
145
+ 7
146
+ 4
147
+ 64
148
+ 47
149
+ 49
150
+ 5
151
+ 1
152
+ 15
153
+ 8
154
+ 30
155
+ 7
156
+ 4
157
+ 64
158
+ 49
159
+ 2
160
+ 1
161
+ 19
162
+ 0
163
+ 15
164
+ 45
165
+ 6
166
+ 7
167
+ 43
168
+ 8
169
+ 43
170
+ 9
171
+ 13
172
+ 71
173
+ 2
174
+ 47
175
+ 9
176
+ 58
177
+ 47
178
+ 49
179
+ 3
180
+ 0
181
+ 13
182
+ 47
183
+ 49
184
+ 5
185
+ 0
186
+ 15
187
+ 8
188
+ 61
189
+ 49
190
+ 2
191
+ 0
192
+ 19
193
+ 1
194
+ 15
195
+ 20
196
+ 1
197
+ 20
198
+ 0
199
+ 49
200
+ 10
201
+ 1
202
+ 49
203
+ 11
204
+ 0
205
+ 7
206
+ 12
207
+ 64
208
+ 83
209
+ 13
210
+ 11
211
+ I
212
+ 6
213
+ I
214
+ 2
215
+ I
216
+ 0
217
+ I
218
+ 0
219
+ I
220
+ -2
221
+ p
222
+ 14
223
+ x
224
+ 13
225
+ ArgumentError
226
+ n
227
+ x
228
+ 3
229
+ new
230
+ x
231
+ 8
232
+ allocate
233
+ s
234
+ 12
235
+ not expected
236
+ x
237
+ 10
238
+ initialize
239
+ x
240
+ 10
241
+ Lumberjack
242
+ n
243
+ x
244
+ 9
245
+ Formatter
246
+ x
247
+ 18
248
+ ExceptionFormatter
249
+ x
250
+ 4
251
+ call
252
+ x
253
+ 6
254
+ should
255
+ s
256
+ 27
257
+ ArgumentError: not expected
258
+ x
259
+ 2
260
+ ==
261
+ p
262
+ 7
263
+ I
264
+ 0
265
+ I
266
+ 6
267
+ I
268
+ 21
269
+ I
270
+ 7
271
+ I
272
+ 40
273
+ I
274
+ 8
275
+ I
276
+ 50
277
+ x
278
+ 81
279
+ /Users/bdurand/dev/projects/lumberjack/spec/formatter/exception_formatter_spec.rb
280
+ p
281
+ 2
282
+ x
283
+ 1
284
+ e
285
+ x
286
+ 9
287
+ formatter
288
+ x
289
+ 2
290
+ it
291
+ s
292
+ 56
293
+ should convert an exception with a backtrace to a string
294
+ M
295
+ 1
296
+ p
297
+ 2
298
+ x
299
+ 9
300
+ for_block
301
+ t
302
+ n
303
+ x
304
+ 9
305
+ __block__
306
+ i
307
+ 157
308
+ 26
309
+ 93
310
+ 0
311
+ 15
312
+ 29
313
+ 45
314
+ 0
315
+ 5
316
+ 45
317
+ 0
318
+ 1
319
+ 13
320
+ 71
321
+ 2
322
+ 47
323
+ 9
324
+ 32
325
+ 47
326
+ 49
327
+ 3
328
+ 0
329
+ 13
330
+ 7
331
+ 4
332
+ 64
333
+ 47
334
+ 49
335
+ 5
336
+ 1
337
+ 15
338
+ 8
339
+ 38
340
+ 7
341
+ 4
342
+ 64
343
+ 49
344
+ 2
345
+ 1
346
+ 47
347
+ 49
348
+ 6
349
+ 1
350
+ 30
351
+ 8
352
+ 153
353
+ 26
354
+ 93
355
+ 1
356
+ 15
357
+ 24
358
+ 13
359
+ 45
360
+ 7
361
+ 8
362
+ 12
363
+ 49
364
+ 9
365
+ 1
366
+ 10
367
+ 62
368
+ 8
369
+ 148
370
+ 15
371
+ 24
372
+ 19
373
+ 0
374
+ 15
375
+ 45
376
+ 10
377
+ 11
378
+ 43
379
+ 12
380
+ 43
381
+ 13
382
+ 13
383
+ 71
384
+ 2
385
+ 47
386
+ 9
387
+ 92
388
+ 47
389
+ 49
390
+ 3
391
+ 0
392
+ 13
393
+ 47
394
+ 49
395
+ 5
396
+ 0
397
+ 15
398
+ 8
399
+ 95
400
+ 49
401
+ 2
402
+ 0
403
+ 19
404
+ 1
405
+ 15
406
+ 20
407
+ 1
408
+ 20
409
+ 0
410
+ 49
411
+ 14
412
+ 1
413
+ 49
414
+ 15
415
+ 0
416
+ 7
417
+ 16
418
+ 45
419
+ 10
420
+ 17
421
+ 43
422
+ 18
423
+ 47
424
+ 101
425
+ 19
426
+ 7
427
+ 20
428
+ 20
429
+ 0
430
+ 49
431
+ 21
432
+ 0
433
+ 45
434
+ 10
435
+ 22
436
+ 43
437
+ 18
438
+ 7
439
+ 20
440
+ 64
441
+ 81
442
+ 23
443
+ 49
444
+ 24
445
+ 1
446
+ 47
447
+ 101
448
+ 19
449
+ 63
450
+ 4
451
+ 83
452
+ 25
453
+ 25
454
+ 8
455
+ 153
456
+ 15
457
+ 92
458
+ 1
459
+ 27
460
+ 34
461
+ 92
462
+ 0
463
+ 27
464
+ 11
465
+ I
466
+ c
467
+ I
468
+ 2
469
+ I
470
+ 0
471
+ I
472
+ 0
473
+ I
474
+ -2
475
+ p
476
+ 26
477
+ x
478
+ 13
479
+ ArgumentError
480
+ n
481
+ x
482
+ 3
483
+ new
484
+ x
485
+ 8
486
+ allocate
487
+ s
488
+ 12
489
+ not expected
490
+ x
491
+ 10
492
+ initialize
493
+ x
494
+ 5
495
+ raise
496
+ x
497
+ 13
498
+ StandardError
499
+ n
500
+ x
501
+ 3
502
+ ===
503
+ x
504
+ 10
505
+ Lumberjack
506
+ n
507
+ x
508
+ 9
509
+ Formatter
510
+ x
511
+ 18
512
+ ExceptionFormatter
513
+ x
514
+ 4
515
+ call
516
+ x
517
+ 6
518
+ should
519
+ s
520
+ 27
521
+ ArgumentError: not expected
522
+ n
523
+ x
524
+ 14
525
+ LINE_SEPARATOR
526
+ x
527
+ 4
528
+ to_s
529
+ s
530
+ 2
531
+
532
+ x
533
+ 9
534
+ backtrace
535
+ n
536
+ x
537
+ 1
538
+ +
539
+ x
540
+ 4
541
+ join
542
+ x
543
+ 2
544
+ ==
545
+ p
546
+ 13
547
+ I
548
+ 0
549
+ I
550
+ d
551
+ I
552
+ 32
553
+ I
554
+ e
555
+ I
556
+ 3f
557
+ I
558
+ 11
559
+ I
560
+ 40
561
+ I
562
+ e
563
+ I
564
+ 43
565
+ I
566
+ f
567
+ I
568
+ 62
569
+ I
570
+ 10
571
+ I
572
+ 9d
573
+ x
574
+ 81
575
+ /Users/bdurand/dev/projects/lumberjack/spec/formatter/exception_formatter_spec.rb
576
+ p
577
+ 2
578
+ x
579
+ 1
580
+ e
581
+ x
582
+ 9
583
+ formatter
584
+ p
585
+ 5
586
+ I
587
+ 0
588
+ I
589
+ 5
590
+ I
591
+ b
592
+ I
593
+ b
594
+ I
595
+ 16
596
+ x
597
+ 81
598
+ /Users/bdurand/dev/projects/lumberjack/spec/formatter/exception_formatter_spec.rb
599
+ p
600
+ 0
601
+ x
602
+ 8
603
+ describe
604
+ p
605
+ 5
606
+ I
607
+ 0
608
+ I
609
+ 1
610
+ I
611
+ 9
612
+ I
613
+ 3
614
+ I
615
+ 1a
616
+ x
617
+ 81
618
+ /Users/bdurand/dev/projects/lumberjack/spec/formatter/exception_formatter_spec.rb
619
+ p
620
+ 0