lumberjack 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT_LICENSE +20 -0
- data/README.rdoc +86 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/lib/lumberjack.rb +39 -0
- data/lib/lumberjack/device.rb +26 -0
- data/lib/lumberjack/device/date_rolling_log_file.rb +58 -0
- data/lib/lumberjack/device/log_file.rb +18 -0
- data/lib/lumberjack/device/null.rb +15 -0
- data/lib/lumberjack/device/rolling_log_file.rb +109 -0
- data/lib/lumberjack/device/size_rolling_log_file.rb +58 -0
- data/lib/lumberjack/device/writer.rb +119 -0
- data/lib/lumberjack/formatter.rb +76 -0
- data/lib/lumberjack/formatter/exception_formatter.rb +12 -0
- data/lib/lumberjack/formatter/inspect_formatter.rb +10 -0
- data/lib/lumberjack/formatter/pretty_print_formatter.rb +23 -0
- data/lib/lumberjack/formatter/string_formatter.rb +10 -0
- data/lib/lumberjack/log_entry.rb +36 -0
- data/lib/lumberjack/logger.rb +302 -0
- data/lib/lumberjack/rack.rb +5 -0
- data/lib/lumberjack/rack/unit_of_work.rb +15 -0
- data/lib/lumberjack/severity.rb +23 -0
- data/lib/lumberjack/template.rb +71 -0
- data/spec/device/date_rolling_log_file_spec.rb +66 -0
- data/spec/device/date_rolling_log_file_spec.rbc +2118 -0
- data/spec/device/log_file_spec.rb +26 -0
- data/spec/device/log_file_spec.rbc +727 -0
- data/spec/device/null_spec.rb +12 -0
- data/spec/device/null_spec.rbc +362 -0
- data/spec/device/rolling_log_file_spec.rb +117 -0
- data/spec/device/rolling_log_file_spec.rbc +2894 -0
- data/spec/device/size_rolling_log_file_spec.rb +54 -0
- data/spec/device/size_rolling_log_file_spec.rbc +1961 -0
- data/spec/device/stream_spec.rbc +3310 -0
- data/spec/device/writer_spec.rb +118 -0
- data/spec/entry_spec.rbc +2333 -0
- data/spec/formatter/exception_formatter_spec.rb +20 -0
- data/spec/formatter/exception_formatter_spec.rbc +620 -0
- data/spec/formatter/inspect_formatter_spec.rb +13 -0
- data/spec/formatter/inspect_formatter_spec.rbc +360 -0
- data/spec/formatter/pretty_print_formatter_spec.rb +14 -0
- data/spec/formatter/pretty_print_formatter_spec.rbc +380 -0
- data/spec/formatter/string_formatter_spec.rb +12 -0
- data/spec/formatter/string_formatter_spec.rbc +314 -0
- data/spec/formatter_spec.rb +45 -0
- data/spec/formatter_spec.rbc +1431 -0
- data/spec/log_entry_spec.rb +69 -0
- data/spec/logger_spec.rb +390 -0
- data/spec/logger_spec.rbc +10043 -0
- data/spec/lumberjack_spec.rb +22 -0
- data/spec/lumberjack_spec.rbc +523 -0
- data/spec/rack/unit_of_work_spec.rb +26 -0
- data/spec/rack/unit_of_work_spec.rbc +697 -0
- data/spec/severity_spec.rb +23 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/spec_helper.rbc +391 -0
- data/spec/template_spec.rb +34 -0
- data/spec/template_spec.rbc +1563 -0
- data/spec/unique_identifier_spec.rbc +329 -0
- metadata +128 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lumberjack::Device::LogFile do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
create_tmp_dir
|
7
|
+
end
|
8
|
+
|
9
|
+
after :all do
|
10
|
+
delete_tmp_dir
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should append to a file" do
|
14
|
+
log_file = File.join(tmp_dir, "a#{rand(1000000000)}.log")
|
15
|
+
File.open(log_file, 'w') do |f|
|
16
|
+
f.puts("Existing contents")
|
17
|
+
end
|
18
|
+
|
19
|
+
device = Lumberjack::Device::LogFile.new(log_file, :template => ":message")
|
20
|
+
device.write(Lumberjack::LogEntry.new(Time.now, 1, "New log entry", nil, $$, nil))
|
21
|
+
device.close
|
22
|
+
|
23
|
+
File.read(log_file).should == "Existing contents\nNew log entry#{Lumberjack::LINE_SEPARATOR}"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,727 @@
|
|
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
|
+
6
|
62
|
+
Device
|
63
|
+
x
|
64
|
+
7
|
65
|
+
LogFile
|
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
|
+
31
|
80
|
+
5
|
81
|
+
7
|
82
|
+
0
|
83
|
+
56
|
84
|
+
1
|
85
|
+
47
|
86
|
+
50
|
87
|
+
2
|
88
|
+
1
|
89
|
+
15
|
90
|
+
5
|
91
|
+
7
|
92
|
+
0
|
93
|
+
56
|
94
|
+
3
|
95
|
+
47
|
96
|
+
50
|
97
|
+
4
|
98
|
+
1
|
99
|
+
15
|
100
|
+
5
|
101
|
+
7
|
102
|
+
5
|
103
|
+
64
|
104
|
+
56
|
105
|
+
6
|
106
|
+
47
|
107
|
+
50
|
108
|
+
7
|
109
|
+
1
|
110
|
+
11
|
111
|
+
I
|
112
|
+
4
|
113
|
+
I
|
114
|
+
0
|
115
|
+
I
|
116
|
+
0
|
117
|
+
I
|
118
|
+
0
|
119
|
+
I
|
120
|
+
-2
|
121
|
+
p
|
122
|
+
8
|
123
|
+
x
|
124
|
+
3
|
125
|
+
all
|
126
|
+
M
|
127
|
+
1
|
128
|
+
p
|
129
|
+
2
|
130
|
+
x
|
131
|
+
9
|
132
|
+
for_block
|
133
|
+
t
|
134
|
+
n
|
135
|
+
x
|
136
|
+
9
|
137
|
+
__block__
|
138
|
+
i
|
139
|
+
4
|
140
|
+
5
|
141
|
+
48
|
142
|
+
0
|
143
|
+
11
|
144
|
+
I
|
145
|
+
2
|
146
|
+
I
|
147
|
+
0
|
148
|
+
I
|
149
|
+
0
|
150
|
+
I
|
151
|
+
0
|
152
|
+
I
|
153
|
+
-2
|
154
|
+
p
|
155
|
+
1
|
156
|
+
x
|
157
|
+
14
|
158
|
+
create_tmp_dir
|
159
|
+
p
|
160
|
+
3
|
161
|
+
I
|
162
|
+
0
|
163
|
+
I
|
164
|
+
6
|
165
|
+
I
|
166
|
+
4
|
167
|
+
x
|
168
|
+
67
|
169
|
+
/Users/bdurand/dev/projects/lumberjack/spec/device/log_file_spec.rb
|
170
|
+
p
|
171
|
+
0
|
172
|
+
x
|
173
|
+
6
|
174
|
+
before
|
175
|
+
M
|
176
|
+
1
|
177
|
+
p
|
178
|
+
2
|
179
|
+
x
|
180
|
+
9
|
181
|
+
for_block
|
182
|
+
t
|
183
|
+
n
|
184
|
+
x
|
185
|
+
9
|
186
|
+
__block__
|
187
|
+
i
|
188
|
+
4
|
189
|
+
5
|
190
|
+
48
|
191
|
+
0
|
192
|
+
11
|
193
|
+
I
|
194
|
+
2
|
195
|
+
I
|
196
|
+
0
|
197
|
+
I
|
198
|
+
0
|
199
|
+
I
|
200
|
+
0
|
201
|
+
I
|
202
|
+
-2
|
203
|
+
p
|
204
|
+
1
|
205
|
+
x
|
206
|
+
14
|
207
|
+
delete_tmp_dir
|
208
|
+
p
|
209
|
+
3
|
210
|
+
I
|
211
|
+
0
|
212
|
+
I
|
213
|
+
a
|
214
|
+
I
|
215
|
+
4
|
216
|
+
x
|
217
|
+
67
|
218
|
+
/Users/bdurand/dev/projects/lumberjack/spec/device/log_file_spec.rb
|
219
|
+
p
|
220
|
+
0
|
221
|
+
x
|
222
|
+
5
|
223
|
+
after
|
224
|
+
s
|
225
|
+
23
|
226
|
+
should append to a file
|
227
|
+
M
|
228
|
+
1
|
229
|
+
p
|
230
|
+
2
|
231
|
+
x
|
232
|
+
9
|
233
|
+
for_block
|
234
|
+
t
|
235
|
+
n
|
236
|
+
x
|
237
|
+
9
|
238
|
+
__block__
|
239
|
+
i
|
240
|
+
215
|
241
|
+
45
|
242
|
+
0
|
243
|
+
1
|
244
|
+
5
|
245
|
+
48
|
246
|
+
2
|
247
|
+
7
|
248
|
+
3
|
249
|
+
5
|
250
|
+
7
|
251
|
+
4
|
252
|
+
47
|
253
|
+
49
|
254
|
+
5
|
255
|
+
1
|
256
|
+
47
|
257
|
+
101
|
258
|
+
6
|
259
|
+
7
|
260
|
+
7
|
261
|
+
63
|
262
|
+
3
|
263
|
+
49
|
264
|
+
8
|
265
|
+
2
|
266
|
+
19
|
267
|
+
0
|
268
|
+
15
|
269
|
+
45
|
270
|
+
0
|
271
|
+
9
|
272
|
+
20
|
273
|
+
0
|
274
|
+
7
|
275
|
+
10
|
276
|
+
64
|
277
|
+
56
|
278
|
+
11
|
279
|
+
50
|
280
|
+
12
|
281
|
+
2
|
282
|
+
15
|
283
|
+
45
|
284
|
+
13
|
285
|
+
14
|
286
|
+
43
|
287
|
+
15
|
288
|
+
43
|
289
|
+
16
|
290
|
+
13
|
291
|
+
71
|
292
|
+
17
|
293
|
+
47
|
294
|
+
9
|
295
|
+
86
|
296
|
+
47
|
297
|
+
49
|
298
|
+
18
|
299
|
+
0
|
300
|
+
13
|
301
|
+
20
|
302
|
+
0
|
303
|
+
44
|
304
|
+
43
|
305
|
+
19
|
306
|
+
79
|
307
|
+
49
|
308
|
+
20
|
309
|
+
1
|
310
|
+
13
|
311
|
+
7
|
312
|
+
21
|
313
|
+
7
|
314
|
+
22
|
315
|
+
64
|
316
|
+
49
|
317
|
+
23
|
318
|
+
2
|
319
|
+
15
|
320
|
+
47
|
321
|
+
49
|
322
|
+
24
|
323
|
+
2
|
324
|
+
15
|
325
|
+
8
|
326
|
+
108
|
327
|
+
20
|
328
|
+
0
|
329
|
+
44
|
330
|
+
43
|
331
|
+
19
|
332
|
+
79
|
333
|
+
49
|
334
|
+
20
|
335
|
+
1
|
336
|
+
13
|
337
|
+
7
|
338
|
+
21
|
339
|
+
7
|
340
|
+
22
|
341
|
+
64
|
342
|
+
49
|
343
|
+
23
|
344
|
+
2
|
345
|
+
15
|
346
|
+
49
|
347
|
+
17
|
348
|
+
2
|
349
|
+
19
|
350
|
+
1
|
351
|
+
15
|
352
|
+
20
|
353
|
+
1
|
354
|
+
45
|
355
|
+
13
|
356
|
+
25
|
357
|
+
43
|
358
|
+
26
|
359
|
+
13
|
360
|
+
71
|
361
|
+
17
|
362
|
+
47
|
363
|
+
9
|
364
|
+
156
|
365
|
+
47
|
366
|
+
49
|
367
|
+
18
|
368
|
+
0
|
369
|
+
13
|
370
|
+
45
|
371
|
+
27
|
372
|
+
28
|
373
|
+
49
|
374
|
+
29
|
375
|
+
0
|
376
|
+
79
|
377
|
+
7
|
378
|
+
30
|
379
|
+
64
|
380
|
+
1
|
381
|
+
99
|
382
|
+
43
|
383
|
+
31
|
384
|
+
7
|
385
|
+
32
|
386
|
+
49
|
387
|
+
33
|
388
|
+
1
|
389
|
+
1
|
390
|
+
47
|
391
|
+
49
|
392
|
+
24
|
393
|
+
6
|
394
|
+
15
|
395
|
+
8
|
396
|
+
179
|
397
|
+
45
|
398
|
+
27
|
399
|
+
34
|
400
|
+
49
|
401
|
+
29
|
402
|
+
0
|
403
|
+
79
|
404
|
+
7
|
405
|
+
30
|
406
|
+
64
|
407
|
+
1
|
408
|
+
99
|
409
|
+
43
|
410
|
+
31
|
411
|
+
7
|
412
|
+
32
|
413
|
+
49
|
414
|
+
33
|
415
|
+
1
|
416
|
+
1
|
417
|
+
49
|
418
|
+
17
|
419
|
+
6
|
420
|
+
49
|
421
|
+
35
|
422
|
+
1
|
423
|
+
15
|
424
|
+
20
|
425
|
+
1
|
426
|
+
49
|
427
|
+
36
|
428
|
+
0
|
429
|
+
15
|
430
|
+
45
|
431
|
+
0
|
432
|
+
37
|
433
|
+
20
|
434
|
+
0
|
435
|
+
49
|
436
|
+
38
|
437
|
+
1
|
438
|
+
49
|
439
|
+
39
|
440
|
+
0
|
441
|
+
7
|
442
|
+
40
|
443
|
+
45
|
444
|
+
13
|
445
|
+
41
|
446
|
+
43
|
447
|
+
42
|
448
|
+
47
|
449
|
+
101
|
450
|
+
6
|
451
|
+
63
|
452
|
+
2
|
453
|
+
83
|
454
|
+
43
|
455
|
+
11
|
456
|
+
I
|
457
|
+
c
|
458
|
+
I
|
459
|
+
2
|
460
|
+
I
|
461
|
+
0
|
462
|
+
I
|
463
|
+
0
|
464
|
+
I
|
465
|
+
-2
|
466
|
+
p
|
467
|
+
44
|
468
|
+
x
|
469
|
+
4
|
470
|
+
File
|
471
|
+
n
|
472
|
+
x
|
473
|
+
7
|
474
|
+
tmp_dir
|
475
|
+
s
|
476
|
+
1
|
477
|
+
a
|
478
|
+
I
|
479
|
+
3b9aca00
|
480
|
+
x
|
481
|
+
4
|
482
|
+
rand
|
483
|
+
x
|
484
|
+
4
|
485
|
+
to_s
|
486
|
+
s
|
487
|
+
4
|
488
|
+
.log
|
489
|
+
x
|
490
|
+
4
|
491
|
+
join
|
492
|
+
n
|
493
|
+
s
|
494
|
+
1
|
495
|
+
w
|
496
|
+
M
|
497
|
+
1
|
498
|
+
p
|
499
|
+
2
|
500
|
+
x
|
501
|
+
9
|
502
|
+
for_block
|
503
|
+
t
|
504
|
+
n
|
505
|
+
x
|
506
|
+
9
|
507
|
+
__block__
|
508
|
+
i
|
509
|
+
13
|
510
|
+
57
|
511
|
+
19
|
512
|
+
0
|
513
|
+
15
|
514
|
+
20
|
515
|
+
0
|
516
|
+
7
|
517
|
+
0
|
518
|
+
64
|
519
|
+
49
|
520
|
+
1
|
521
|
+
1
|
522
|
+
11
|
523
|
+
I
|
524
|
+
4
|
525
|
+
I
|
526
|
+
1
|
527
|
+
I
|
528
|
+
1
|
529
|
+
I
|
530
|
+
1
|
531
|
+
n
|
532
|
+
p
|
533
|
+
2
|
534
|
+
s
|
535
|
+
17
|
536
|
+
Existing contents
|
537
|
+
x
|
538
|
+
4
|
539
|
+
puts
|
540
|
+
p
|
541
|
+
5
|
542
|
+
I
|
543
|
+
0
|
544
|
+
I
|
545
|
+
f
|
546
|
+
I
|
547
|
+
4
|
548
|
+
I
|
549
|
+
10
|
550
|
+
I
|
551
|
+
d
|
552
|
+
x
|
553
|
+
67
|
554
|
+
/Users/bdurand/dev/projects/lumberjack/spec/device/log_file_spec.rb
|
555
|
+
p
|
556
|
+
1
|
557
|
+
x
|
558
|
+
1
|
559
|
+
f
|
560
|
+
x
|
561
|
+
4
|
562
|
+
open
|
563
|
+
x
|
564
|
+
10
|
565
|
+
Lumberjack
|
566
|
+
n
|
567
|
+
x
|
568
|
+
6
|
569
|
+
Device
|
570
|
+
x
|
571
|
+
7
|
572
|
+
LogFile
|
573
|
+
x
|
574
|
+
3
|
575
|
+
new
|
576
|
+
x
|
577
|
+
8
|
578
|
+
allocate
|
579
|
+
x
|
580
|
+
4
|
581
|
+
Hash
|
582
|
+
x
|
583
|
+
16
|
584
|
+
new_from_literal
|
585
|
+
x
|
586
|
+
8
|
587
|
+
template
|
588
|
+
s
|
589
|
+
8
|
590
|
+
:message
|
591
|
+
x
|
592
|
+
3
|
593
|
+
[]=
|
594
|
+
x
|
595
|
+
10
|
596
|
+
initialize
|
597
|
+
n
|
598
|
+
x
|
599
|
+
5
|
600
|
+
Entry
|
601
|
+
x
|
602
|
+
4
|
603
|
+
Time
|
604
|
+
n
|
605
|
+
x
|
606
|
+
3
|
607
|
+
now
|
608
|
+
s
|
609
|
+
13
|
610
|
+
New log entry
|
611
|
+
x
|
612
|
+
7
|
613
|
+
Globals
|
614
|
+
x
|
615
|
+
2
|
616
|
+
$$
|
617
|
+
x
|
618
|
+
2
|
619
|
+
[]
|
620
|
+
n
|
621
|
+
x
|
622
|
+
5
|
623
|
+
write
|
624
|
+
x
|
625
|
+
5
|
626
|
+
close
|
627
|
+
n
|
628
|
+
x
|
629
|
+
4
|
630
|
+
read
|
631
|
+
x
|
632
|
+
6
|
633
|
+
should
|
634
|
+
s
|
635
|
+
31
|
636
|
+
Existing contents
|
637
|
+
New log entry
|
638
|
+
n
|
639
|
+
x
|
640
|
+
14
|
641
|
+
LINE_SEPARATOR
|
642
|
+
x
|
643
|
+
2
|
644
|
+
==
|
645
|
+
p
|
646
|
+
13
|
647
|
+
I
|
648
|
+
0
|
649
|
+
I
|
650
|
+
e
|
651
|
+
I
|
652
|
+
1c
|
653
|
+
I
|
654
|
+
f
|
655
|
+
I
|
656
|
+
2a
|
657
|
+
I
|
658
|
+
13
|
659
|
+
I
|
660
|
+
6f
|
661
|
+
I
|
662
|
+
14
|
663
|
+
I
|
664
|
+
b7
|
665
|
+
I
|
666
|
+
15
|
667
|
+
I
|
668
|
+
bd
|
669
|
+
I
|
670
|
+
17
|
671
|
+
I
|
672
|
+
d7
|
673
|
+
x
|
674
|
+
67
|
675
|
+
/Users/bdurand/dev/projects/lumberjack/spec/device/log_file_spec.rb
|
676
|
+
p
|
677
|
+
2
|
678
|
+
x
|
679
|
+
8
|
680
|
+
log_file
|
681
|
+
x
|
682
|
+
6
|
683
|
+
device
|
684
|
+
x
|
685
|
+
2
|
686
|
+
it
|
687
|
+
p
|
688
|
+
7
|
689
|
+
I
|
690
|
+
0
|
691
|
+
I
|
692
|
+
5
|
693
|
+
I
|
694
|
+
a
|
695
|
+
I
|
696
|
+
9
|
697
|
+
I
|
698
|
+
14
|
699
|
+
I
|
700
|
+
d
|
701
|
+
I
|
702
|
+
1f
|
703
|
+
x
|
704
|
+
67
|
705
|
+
/Users/bdurand/dev/projects/lumberjack/spec/device/log_file_spec.rb
|
706
|
+
p
|
707
|
+
0
|
708
|
+
x
|
709
|
+
8
|
710
|
+
describe
|
711
|
+
p
|
712
|
+
5
|
713
|
+
I
|
714
|
+
0
|
715
|
+
I
|
716
|
+
1
|
717
|
+
I
|
718
|
+
9
|
719
|
+
I
|
720
|
+
3
|
721
|
+
I
|
722
|
+
1a
|
723
|
+
x
|
724
|
+
67
|
725
|
+
/Users/bdurand/dev/projects/lumberjack/spec/device/log_file_spec.rb
|
726
|
+
p
|
727
|
+
0
|