catamaran 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +133 -123
- data/lib/catamaran/formatter.rb +79 -30
- data/lib/catamaran/manager.rb +9 -0
- data/lib/catamaran/version.rb +1 -1
- data/lib/catamaran.rb +1 -0
- data/lib/generators/catamaran/templates/catamaran/development.rb +1 -1
- data/lib/generators/catamaran/templates/catamaran.rb +6 -0
- data/spec/formatter_spec.rb +103 -0
- data/spec/manager_spec.rb +9 -0
- metadata +4 -2
data/README.md
CHANGED
|
@@ -3,10 +3,12 @@ Catamaran
|
|
|
3
3
|
|
|
4
4
|
Logging is a powerful and often undervalued tool in software development. When done right, it's a great way to document code, and it provides a simple & effective way to solve problems when things go awry. All an important part of maintainable code.
|
|
5
5
|
|
|
6
|
+
Catamaran was built around a named hierarchy and level inheritance, and with performance in mind.
|
|
7
|
+
|
|
6
8
|
Gemfile
|
|
7
9
|
-------
|
|
8
10
|
|
|
9
|
-
gem 'catamaran', '~> 2.
|
|
11
|
+
gem 'catamaran', '~> 2.5.0'
|
|
10
12
|
|
|
11
13
|
Rails-related setup:
|
|
12
14
|
|
|
@@ -304,181 +306,186 @@ printer.print(STDOUT)
|
|
|
304
306
|
#### Summary
|
|
305
307
|
|
|
306
308
|
```
|
|
307
|
-
Thread ID:
|
|
308
|
-
Fiber ID:
|
|
309
|
-
Total Time: 0.
|
|
309
|
+
Thread ID: 2152122180
|
|
310
|
+
Fiber ID: 2164584480
|
|
311
|
+
Total Time: 0.69042
|
|
310
312
|
Sort by: total_time
|
|
311
313
|
|
|
312
314
|
%total %self total self wait child calls Name
|
|
313
315
|
--------------------------------------------------------------------------------
|
|
314
|
-
100.00% 0.01% 0.
|
|
315
|
-
0.
|
|
316
|
+
100.00% 0.01% 0.690 0.000 0.000 0.690 1 Global#[No method]
|
|
317
|
+
0.690 0.003 0.000 0.687 1/1 Integer#times
|
|
316
318
|
0.000 0.000 0.000 0.000 1/1 Class#new
|
|
317
319
|
--------------------------------------------------------------------------------
|
|
318
|
-
0.
|
|
319
|
-
99.99% 0.
|
|
320
|
-
0.
|
|
320
|
+
0.690 0.003 0.000 0.687 1/1 Global#[No method]
|
|
321
|
+
99.99% 0.46% 0.690 0.003 0.000 0.687 1 Integer#times
|
|
322
|
+
0.687 0.023 0.000 0.664 1000/4000 WithTheRubyProfiler#run
|
|
321
323
|
--------------------------------------------------------------------------------
|
|
322
324
|
0.000 0.000 0.000 0.000 3000/4000 WithTheRubyProfiler#run
|
|
323
|
-
0.
|
|
324
|
-
99.53% 3.
|
|
325
|
-
0.
|
|
326
|
-
0.
|
|
327
|
-
0.
|
|
328
|
-
0.
|
|
329
|
-
0.
|
|
325
|
+
0.687 0.023 0.000 0.664 1000/4000 Integer#times
|
|
326
|
+
99.53% 3.38% 0.687 0.023 0.000 0.664 4000 *WithTheRubyProfiler#run
|
|
327
|
+
0.134 0.006 0.000 0.128 1000/2000 Catamaran::Logger#error
|
|
328
|
+
0.134 0.006 0.000 0.128 1000/2000 Catamaran::Logger#notice
|
|
329
|
+
0.131 0.006 0.000 0.125 1000/2000 Catamaran::Logger#warn
|
|
330
|
+
0.129 0.006 0.000 0.123 1000/2000 Catamaran::Logger#fatal
|
|
331
|
+
0.129 0.006 0.000 0.123 1000/2000 Catamaran::Logger#severe
|
|
330
332
|
0.000 0.000 0.000 0.000 3/11 Catamaran::Logger#log_level
|
|
331
333
|
0.000 0.000 0.000 0.000 3/8 Module#define_method
|
|
332
334
|
0.000 0.000 0.000 0.000 3/8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
333
|
-
0.000 0.000 0.000 0.000 3/8 Symbol#to_s
|
|
334
335
|
0.000 0.000 0.000 0.000 3/8 String#to_sym
|
|
336
|
+
0.000 0.000 0.000 0.000 3/8 Symbol#to_s
|
|
335
337
|
0.000 0.000 0.000 0.000 3000/4000 WithTheRubyProfiler#run
|
|
336
338
|
--------------------------------------------------------------------------------
|
|
337
|
-
0.
|
|
338
|
-
0.
|
|
339
|
-
0.
|
|
340
|
-
0.
|
|
341
|
-
0.
|
|
342
|
-
88.
|
|
343
|
-
0.
|
|
344
|
-
0.
|
|
345
|
-
--------------------------------------------------------------------------------
|
|
346
|
-
0.
|
|
347
|
-
|
|
348
|
-
0.
|
|
349
|
-
0.
|
|
350
|
-
--------------------------------------------------------------------------------
|
|
351
|
-
0.
|
|
352
|
-
|
|
353
|
-
0.
|
|
354
|
-
0.
|
|
355
|
-
|
|
339
|
+
0.120 0.007 0.000 0.113 1000/5000 Catamaran::Logger#severe
|
|
340
|
+
0.121 0.007 0.000 0.114 1000/5000 Catamaran::Logger#fatal
|
|
341
|
+
0.122 0.007 0.000 0.115 1000/5000 Catamaran::Logger#warn
|
|
342
|
+
0.125 0.007 0.000 0.118 1000/5000 Catamaran::Logger#error
|
|
343
|
+
0.125 0.007 0.000 0.118 1000/5000 Catamaran::Logger#notice
|
|
344
|
+
88.77% 5.03% 0.613 0.035 0.000 0.578 5000 Catamaran::Logger#log
|
|
345
|
+
0.416 0.025 0.000 0.391 5000/5000 Catamaran::Logger#_format_msg
|
|
346
|
+
0.163 0.062 0.000 0.101 5000/5000 <Class::Catamaran::Outputter>#write
|
|
347
|
+
--------------------------------------------------------------------------------
|
|
348
|
+
0.416 0.025 0.000 0.391 5000/5000 Catamaran::Logger#log
|
|
349
|
+
60.19% 3.55% 0.416 0.025 0.000 0.391 5000 Catamaran::Logger#_format_msg
|
|
350
|
+
0.329 0.073 0.000 0.256 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
351
|
+
0.062 0.036 0.000 0.026 5000/5000 Catamaran::Logger#path_to_s
|
|
352
|
+
--------------------------------------------------------------------------------
|
|
353
|
+
0.329 0.073 0.000 0.256 5000/5000 Catamaran::Logger#_format_msg
|
|
354
|
+
47.71% 10.63% 0.329 0.073 0.000 0.256 5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
355
|
+
0.256 0.077 0.000 0.179 5000/5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
356
|
+
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#formatter_pattern
|
|
357
|
+
--------------------------------------------------------------------------------
|
|
358
|
+
0.256 0.077 0.000 0.179 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
359
|
+
37.08% 11.17% 0.256 0.077 0.000 0.179 5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
360
|
+
0.085 0.061 0.000 0.024 5000/5000 Time#strftime
|
|
361
|
+
0.038 0.017 0.000 0.021 5000/5000 <Class::Time>#now
|
|
362
|
+
0.025 0.025 0.000 0.000 5000/5000 Kernel#sprintf
|
|
356
363
|
0.015 0.015 0.000 0.000 5000/5000 <Class::Catamaran::LogLevel>#severity_to_s
|
|
357
364
|
0.009 0.009 0.000 0.000 5000/5000 Fixnum#to_s
|
|
358
|
-
0.
|
|
365
|
+
0.007 0.007 0.000 0.000 5000/5000 <Module::Process>#pid
|
|
359
366
|
--------------------------------------------------------------------------------
|
|
360
|
-
0.
|
|
361
|
-
|
|
362
|
-
0.
|
|
367
|
+
0.163 0.062 0.000 0.101 5000/5000 Catamaran::Logger#log
|
|
368
|
+
23.56% 8.97% 0.163 0.062 0.000 0.101 5000 <Class::Catamaran::Outputter>#write
|
|
369
|
+
0.090 0.021 0.000 0.069 5000/5000 IO#puts
|
|
363
370
|
0.011 0.011 0.000 0.000 9998/10015 Kernel#nil?
|
|
364
|
-
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#stdout?
|
|
365
371
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#stderr?
|
|
372
|
+
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#stdout?
|
|
366
373
|
0.000 0.000 0.000 0.000 2/6 NilClass#nil?
|
|
367
374
|
--------------------------------------------------------------------------------
|
|
368
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
369
|
-
0.
|
|
370
|
-
19.
|
|
371
|
-
0.
|
|
375
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#error
|
|
376
|
+
0.134 0.006 0.000 0.128 1000/2000 WithTheRubyProfiler#run
|
|
377
|
+
19.40% 0.85% 0.134 0.006 0.000 0.128 2000 *Catamaran::Logger#error
|
|
378
|
+
0.125 0.007 0.000 0.118 1000/5000 Catamaran::Logger#log
|
|
372
379
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
373
|
-
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
374
380
|
0.000 0.000 0.000 0.000 1/8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
381
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
375
382
|
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
376
383
|
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
377
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
384
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#error
|
|
378
385
|
--------------------------------------------------------------------------------
|
|
379
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
380
|
-
0.
|
|
381
|
-
19.
|
|
382
|
-
0.
|
|
386
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#notice
|
|
387
|
+
0.134 0.006 0.000 0.128 1000/2000 WithTheRubyProfiler#run
|
|
388
|
+
19.38% 0.85% 0.134 0.006 0.000 0.128 2000 *Catamaran::Logger#notice
|
|
389
|
+
0.125 0.007 0.000 0.118 1000/5000 Catamaran::Logger#log
|
|
383
390
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
384
|
-
0.000 0.000 0.000 0.000 1/8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
385
|
-
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
386
391
|
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
392
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
393
|
+
0.000 0.000 0.000 0.000 1/8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
387
394
|
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
388
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
395
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#notice
|
|
389
396
|
--------------------------------------------------------------------------------
|
|
390
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
391
|
-
0.
|
|
392
|
-
|
|
393
|
-
0.
|
|
397
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#warn
|
|
398
|
+
0.131 0.006 0.000 0.125 1000/2000 WithTheRubyProfiler#run
|
|
399
|
+
18.91% 0.86% 0.131 0.006 0.000 0.125 2000 *Catamaran::Logger#warn
|
|
400
|
+
0.122 0.007 0.000 0.115 1000/5000 Catamaran::Logger#log
|
|
394
401
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
395
402
|
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
396
403
|
0.000 0.000 0.000 0.000 1/8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
397
|
-
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
398
404
|
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
399
|
-
0.000 0.000 0.000 0.000
|
|
405
|
+
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
406
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#warn
|
|
400
407
|
--------------------------------------------------------------------------------
|
|
401
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
402
|
-
0.
|
|
403
|
-
18.
|
|
404
|
-
0.
|
|
408
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#fatal
|
|
409
|
+
0.129 0.006 0.000 0.123 1000/2000 WithTheRubyProfiler#run
|
|
410
|
+
18.73% 0.85% 0.129 0.006 0.000 0.123 2000 *Catamaran::Logger#fatal
|
|
411
|
+
0.121 0.007 0.000 0.114 1000/5000 Catamaran::Logger#log
|
|
405
412
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
406
413
|
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
414
|
+
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
407
415
|
0.000 0.000 0.000 0.000 1/8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
408
416
|
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
409
|
-
0.000 0.000 0.000 0.000
|
|
410
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#severe
|
|
417
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#fatal
|
|
411
418
|
--------------------------------------------------------------------------------
|
|
412
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
413
|
-
0.
|
|
414
|
-
18.
|
|
415
|
-
0.
|
|
419
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#severe
|
|
420
|
+
0.129 0.006 0.000 0.123 1000/2000 WithTheRubyProfiler#run
|
|
421
|
+
18.64% 0.86% 0.129 0.006 0.000 0.123 2000 *Catamaran::Logger#severe
|
|
422
|
+
0.120 0.007 0.000 0.113 1000/5000 Catamaran::Logger#log
|
|
416
423
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
417
424
|
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
418
425
|
0.000 0.000 0.000 0.000 1/8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
419
426
|
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
420
427
|
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
421
|
-
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#
|
|
428
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#severe
|
|
422
429
|
--------------------------------------------------------------------------------
|
|
423
|
-
0.
|
|
424
|
-
|
|
425
|
-
0.
|
|
430
|
+
0.090 0.021 0.000 0.069 5000/5000 <Class::Catamaran::Outputter>#write
|
|
431
|
+
12.98% 3.01% 0.090 0.021 0.000 0.069 5000 IO#puts
|
|
432
|
+
0.069 0.069 0.000 0.000 10000/10000 IO#write
|
|
426
433
|
--------------------------------------------------------------------------------
|
|
427
|
-
0.
|
|
428
|
-
|
|
429
|
-
0.
|
|
434
|
+
0.085 0.061 0.000 0.024 5000/5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
435
|
+
12.34% 8.89% 0.085 0.061 0.000 0.024 5000 Time#strftime
|
|
436
|
+
0.018 0.018 0.000 0.000 10000/10000 Fixnum#divmod
|
|
430
437
|
0.006 0.006 0.000 0.000 5000/5000 Fixnum#%
|
|
431
438
|
--------------------------------------------------------------------------------
|
|
432
|
-
0.
|
|
433
|
-
|
|
439
|
+
0.069 0.069 0.000 0.000 10000/10000 IO#puts
|
|
440
|
+
9.97% 9.97% 0.069 0.069 0.000 0.000 10000 IO#write
|
|
434
441
|
--------------------------------------------------------------------------------
|
|
435
|
-
0.
|
|
436
|
-
8.
|
|
437
|
-
0.
|
|
442
|
+
0.062 0.036 0.000 0.026 5000/5000 Catamaran::Logger#_format_msg
|
|
443
|
+
8.92% 5.16% 0.062 0.036 0.000 0.026 5000 Catamaran::Logger#path_to_s
|
|
444
|
+
0.026 0.026 0.000 0.000 5000/5000 Array#join
|
|
438
445
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#delimiter
|
|
439
446
|
--------------------------------------------------------------------------------
|
|
440
|
-
0.
|
|
441
|
-
|
|
442
|
-
0.
|
|
447
|
+
0.038 0.017 0.000 0.021 5000/5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
448
|
+
5.54% 2.51% 0.038 0.017 0.000 0.021 5000 <Class::Time>#now
|
|
449
|
+
0.021 0.015 0.000 0.006 5000/5000 Time#initialize
|
|
443
450
|
--------------------------------------------------------------------------------
|
|
444
|
-
0.
|
|
445
|
-
|
|
451
|
+
0.026 0.026 0.000 0.000 5000/5000 Catamaran::Logger#path_to_s
|
|
452
|
+
3.77% 3.77% 0.026 0.026 0.000 0.000 5000 Array#join
|
|
446
453
|
--------------------------------------------------------------------------------
|
|
447
|
-
0.
|
|
448
|
-
3.
|
|
449
|
-
0.006 0.006 0.000 0.000 5000/5000 Fixnum#+
|
|
454
|
+
0.025 0.025 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
455
|
+
3.62% 3.62% 0.025 0.025 0.000 0.000 5000 Kernel#sprintf
|
|
450
456
|
--------------------------------------------------------------------------------
|
|
451
|
-
0.
|
|
452
|
-
|
|
457
|
+
0.021 0.015 0.000 0.006 5000/5000 <Class::Time>#now
|
|
458
|
+
3.03% 2.14% 0.021 0.015 0.000 0.006 5000 Time#initialize
|
|
459
|
+
0.006 0.006 0.000 0.000 5000/5000 Fixnum#+
|
|
453
460
|
--------------------------------------------------------------------------------
|
|
454
|
-
0.
|
|
455
|
-
2.
|
|
461
|
+
0.018 0.018 0.000 0.000 10000/10000 Time#strftime
|
|
462
|
+
2.56% 2.56% 0.018 0.018 0.000 0.000 10000 Fixnum#divmod
|
|
456
463
|
--------------------------------------------------------------------------------
|
|
457
|
-
0.015 0.015 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#
|
|
458
|
-
2.
|
|
464
|
+
0.015 0.015 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
465
|
+
2.14% 2.14% 0.015 0.015 0.000 0.000 5000 <Class::Catamaran::LogLevel>#severity_to_s
|
|
459
466
|
--------------------------------------------------------------------------------
|
|
460
467
|
0.000 0.000 0.000 0.000 17/10015 Catamaran::Logger#log_level
|
|
461
468
|
0.011 0.011 0.000 0.000 9998/10015 <Class::Catamaran::Outputter>#write
|
|
462
|
-
1.
|
|
463
|
-
--------------------------------------------------------------------------------
|
|
464
|
-
0.009 0.009 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
465
|
-
1.38% 1.38% 0.009 0.009 0.000 0.000 5000 Fixnum#to_s
|
|
469
|
+
1.61% 1.61% 0.011 0.011 0.000 0.000 10015 Kernel#nil?
|
|
466
470
|
--------------------------------------------------------------------------------
|
|
467
|
-
0.
|
|
468
|
-
1.
|
|
471
|
+
0.009 0.009 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
472
|
+
1.30% 1.30% 0.009 0.009 0.000 0.000 5000 Fixnum#to_s
|
|
469
473
|
--------------------------------------------------------------------------------
|
|
470
|
-
0.
|
|
471
|
-
|
|
474
|
+
0.007 0.007 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_favorite_pattern_number_1
|
|
475
|
+
0.97% 0.97% 0.007 0.007 0.000 0.000 5000 <Module::Process>#pid
|
|
472
476
|
--------------------------------------------------------------------------------
|
|
473
477
|
0.006 0.006 0.000 0.000 5000/5000 Time#initialize
|
|
474
|
-
0.
|
|
478
|
+
0.90% 0.90% 0.006 0.006 0.000 0.000 5000 Fixnum#+
|
|
479
|
+
--------------------------------------------------------------------------------
|
|
480
|
+
0.006 0.006 0.000 0.000 5000/5000 Time#strftime
|
|
481
|
+
0.89% 0.89% 0.006 0.006 0.000 0.000 5000 Fixnum#%
|
|
475
482
|
--------------------------------------------------------------------------------
|
|
476
483
|
0.000 0.000 0.000 0.000 3/11 Catamaran::Logger#log_level
|
|
477
484
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#notice
|
|
478
|
-
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#fatal
|
|
479
485
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#error
|
|
480
|
-
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#severe
|
|
481
486
|
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#warn
|
|
487
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#fatal
|
|
488
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#severe
|
|
482
489
|
0.000 0.000 0.000 0.000 3/11 WithTheRubyProfiler#run
|
|
483
490
|
0.03% 0.02% 0.000 0.000 0.000 0.000 11 *Catamaran::Logger#log_level
|
|
484
491
|
0.000 0.000 0.000 0.000 17/10015 Kernel#nil?
|
|
@@ -487,60 +494,63 @@ Sort by: total_time
|
|
|
487
494
|
0.000 0.000 0.000 0.000 3/11 Catamaran::Logger#log_level
|
|
488
495
|
--------------------------------------------------------------------------------
|
|
489
496
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#notice
|
|
490
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
491
497
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#error
|
|
492
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#
|
|
498
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
493
499
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#severe
|
|
500
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#warn
|
|
494
501
|
0.000 0.000 0.000 0.000 3/8 WithTheRubyProfiler#run
|
|
495
|
-
0.01% 0.
|
|
502
|
+
0.01% 0.01% 0.000 0.000 0.000 0.000 8 Module#define_method
|
|
496
503
|
0.000 0.000 0.000 0.000 8/8 BasicObject#singleton_method_added
|
|
497
504
|
--------------------------------------------------------------------------------
|
|
498
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#error
|
|
499
505
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#notice
|
|
506
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
500
507
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#warn
|
|
501
508
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#severe
|
|
502
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#
|
|
509
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#error
|
|
503
510
|
0.000 0.000 0.000 0.000 3/8 WithTheRubyProfiler#run
|
|
504
511
|
0.00% 0.00% 0.000 0.000 0.000 0.000 8 <Class::Catamaran::LogLevel>#symbol_to_severity
|
|
505
512
|
--------------------------------------------------------------------------------
|
|
506
513
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#error
|
|
507
514
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#notice
|
|
515
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
508
516
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#severe
|
|
509
517
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#warn
|
|
510
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
511
518
|
0.000 0.000 0.000 0.000 3/8 WithTheRubyProfiler#run
|
|
512
|
-
0.00% 0.00% 0.000 0.000 0.000 0.000 8
|
|
513
|
-
--------------------------------------------------------------------------------
|
|
514
|
-
0.000 0.000 0.000 0.000 8/8 Module#define_method
|
|
515
|
-
0.00% 0.00% 0.000 0.000 0.000 0.000 8 BasicObject#singleton_method_added
|
|
519
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 8 String#to_sym
|
|
516
520
|
--------------------------------------------------------------------------------
|
|
517
521
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#error
|
|
518
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#
|
|
522
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#warn
|
|
519
523
|
0.000 0.000 0.000 0.000 3/8 WithTheRubyProfiler#run
|
|
520
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
521
524
|
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#severe
|
|
522
|
-
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#
|
|
523
|
-
|
|
525
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#notice
|
|
526
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
527
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 8 Symbol#to_s
|
|
528
|
+
--------------------------------------------------------------------------------
|
|
529
|
+
0.000 0.000 0.000 0.000 8/8 Module#define_method
|
|
530
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 8 BasicObject#singleton_method_added
|
|
524
531
|
--------------------------------------------------------------------------------
|
|
525
532
|
0.000 0.000 0.000 0.000 2/6 <Class::Catamaran::Outputter>#write
|
|
526
533
|
0.000 0.000 0.000 0.000 4/6 Catamaran::Logger#log_level
|
|
527
534
|
0.00% 0.00% 0.000 0.000 0.000 0.000 6 NilClass#nil?
|
|
528
535
|
--------------------------------------------------------------------------------
|
|
529
536
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Outputter>#write
|
|
530
|
-
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#
|
|
537
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#stderr?
|
|
531
538
|
--------------------------------------------------------------------------------
|
|
532
539
|
0.000 0.000 0.000 0.000 1/1 Global#[No method]
|
|
533
540
|
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Class#new
|
|
534
541
|
0.000 0.000 0.000 0.000 1/1 BasicObject#initialize
|
|
535
542
|
--------------------------------------------------------------------------------
|
|
536
543
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Outputter>#write
|
|
537
|
-
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#
|
|
544
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#stdout?
|
|
538
545
|
--------------------------------------------------------------------------------
|
|
539
546
|
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#path_to_s
|
|
540
547
|
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#delimiter
|
|
541
548
|
--------------------------------------------------------------------------------
|
|
542
549
|
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#log_level
|
|
543
550
|
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Object::Object>#[]
|
|
551
|
+
--------------------------------------------------------------------------------
|
|
552
|
+
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
553
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#formatter_pattern
|
|
544
554
|
--------------------------------------------------------------------------------
|
|
545
555
|
0.000 0.000 0.000 0.000 1/1 Class#new
|
|
546
556
|
0.00% 0.00% 0.000 0.000 0.000 0.000 1 BasicObject#initialize
|
data/lib/catamaran/formatter.rb
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
module Catamaran
|
|
2
|
-
class Formatter
|
|
3
|
-
# Using caller() in the log messages is DISABLED by default
|
|
2
|
+
class Formatter
|
|
4
3
|
@@caller_enabled = false
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
FAVORITE_FORMATTER_PATTERNS = {
|
|
6
|
+
"%-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m" => 1,
|
|
7
|
+
"%c pid-%P [%d] %p - %m" => 2
|
|
8
|
+
}
|
|
9
9
|
|
|
10
|
-
def self.caller_enabled
|
|
11
|
-
@@caller_enabled
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
##
|
|
15
|
-
# Construct a properly formatted log message based
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def self.construct_formatted_message( severity, path, msg, opts )
|
|
19
|
-
msg = sprintf( "%6s pid-#{Process.pid} [#{Time.now.strftime( "%G-%m-%d %H:%M:%S:%L" )}] %47s - #{msg}",
|
|
20
|
-
LogLevel.severity_to_s( severity ),
|
|
21
|
-
( path.length > 47 ) ? path.dup[-47,47] : path )
|
|
22
10
|
|
|
11
|
+
def self.construct_formatted_message( severity, path, msg, opts = nil )
|
|
12
|
+
if opts && opts[:pattern]
|
|
13
|
+
full_msg = construct_custom_pattern( severity, path, msg, opts )
|
|
14
|
+
else
|
|
15
|
+
unless @favorite_pattern_number
|
|
16
|
+
@favorite_pattern_number = FAVORITE_FORMATTER_PATTERNS[Manager::formatter_pattern]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
if ( @favorite_pattern_number == 1 )
|
|
20
|
+
full_msg = construct_favorite_pattern_number_1( severity, path, msg, opts )
|
|
21
|
+
elsif ( @favorite_pattern_number == 2 )
|
|
22
|
+
full_msg = construct_favorite_pattern_number_2( severity, path, msg, opts )
|
|
23
|
+
else
|
|
24
|
+
# A "favorite pattern" (better for performance) was not specified. Construct a custom message
|
|
25
|
+
full_msg = construct_custom_pattern( severity, path, msg, opts )
|
|
26
|
+
end
|
|
27
|
+
end
|
|
23
28
|
|
|
24
29
|
|
|
25
30
|
##
|
|
@@ -43,31 +48,31 @@ module Catamaran
|
|
|
43
48
|
# Otherwise append what optional information we can determine
|
|
44
49
|
|
|
45
50
|
if append_caller_information
|
|
46
|
-
|
|
51
|
+
full_msg << " (#{caller(4)[0]})"
|
|
47
52
|
else
|
|
48
53
|
##
|
|
49
54
|
# Append some suffix info if it has been specified
|
|
50
55
|
#
|
|
51
56
|
if opts
|
|
52
57
|
if opts[:file]
|
|
53
|
-
|
|
58
|
+
full_msg << " (#{opts[:file]}"
|
|
54
59
|
|
|
55
60
|
if opts[:line]
|
|
56
|
-
|
|
61
|
+
full_msg << ":#{opts[:line]}"
|
|
57
62
|
end
|
|
58
63
|
|
|
59
64
|
if opts[:class] || opts[:method]
|
|
60
|
-
|
|
65
|
+
full_msg << ":in `"
|
|
61
66
|
|
|
62
67
|
if opts[:class]
|
|
63
|
-
|
|
68
|
+
full_msg << "#{opts[:class]}."
|
|
64
69
|
end
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
full_msg << "#{opts[:method]}" if opts[:method]
|
|
72
|
+
full_msg << "'"
|
|
68
73
|
end
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
full_msg << ')'
|
|
71
76
|
end
|
|
72
77
|
end
|
|
73
78
|
end
|
|
@@ -77,12 +82,56 @@ module Catamaran
|
|
|
77
82
|
# Append the backtrace information if it has been requested by the user
|
|
78
83
|
if opts && opts[:backtrace] == true
|
|
79
84
|
# Implicit return
|
|
80
|
-
|
|
85
|
+
full_msg << " from:\n#{caller(4).take(10).join("\n")}"
|
|
81
86
|
end
|
|
82
87
|
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
full_msg
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def self.caller_enabled=( boolean_value )
|
|
92
|
+
@@caller_enabled = boolean_value
|
|
85
93
|
end
|
|
94
|
+
|
|
95
|
+
def self.caller_enabled
|
|
96
|
+
@@caller_enabled
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def self.append_caller_information?
|
|
100
|
+
@@caller_enabled
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def self.reset
|
|
104
|
+
@favorite_pattern_number = nil
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
protected
|
|
109
|
+
|
|
110
|
+
def self.construct_favorite_pattern_number_1( severity, path, msg, opts )
|
|
111
|
+
sprintf( "%6s pid-#{Process.pid} [#{Time.now.strftime( "%G-%m-%d %H:%M:%S:%L" )}] %47s - #{msg}",
|
|
112
|
+
LogLevel.severity_to_s( severity ),
|
|
113
|
+
( path.length > 47 ) ? path.dup[-47,47] : path )
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def self.construct_favorite_pattern_number_2( severity, path, msg, opts )
|
|
117
|
+
sprintf( "%6s pid-#{Process.pid} [#{Time.now.to_s}] %s - #{msg}",
|
|
118
|
+
LogLevel.severity_to_s( severity ),
|
|
119
|
+
path )
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def self.construct_custom_pattern( severity, path, msg, opts )
|
|
123
|
+
if opts && opts[:pattern]
|
|
124
|
+
full_msg = opts[:pattern].dup # dup may be extra work
|
|
125
|
+
else
|
|
126
|
+
full_msg = Manager::formatter_pattern.dup
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
full_msg.gsub! /%d/, Time.now.to_s
|
|
130
|
+
full_msg.gsub! /%c/, LogLevel.severity_to_s(severity).rjust(6)
|
|
131
|
+
full_msg.gsub! /%P/, Process.pid.to_s
|
|
132
|
+
full_msg.gsub! /%p/, path
|
|
133
|
+
full_msg.gsub! /%m/, msg
|
|
134
|
+
end
|
|
135
|
+
|
|
86
136
|
end
|
|
87
|
-
end
|
|
88
|
-
|
|
137
|
+
end
|
data/lib/catamaran/manager.rb
CHANGED
|
@@ -28,6 +28,13 @@ module Catamaran
|
|
|
28
28
|
Catamaran::Formatter.caller_enabled
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
def self.formatter_pattern
|
|
32
|
+
@formatter_pattern ||= "%-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.formatter_pattern=( value )
|
|
36
|
+
@formatter_pattern = value
|
|
37
|
+
end
|
|
31
38
|
|
|
32
39
|
|
|
33
40
|
##
|
|
@@ -48,6 +55,8 @@ module Catamaran
|
|
|
48
55
|
|
|
49
56
|
Catamaran::Outputter.reset
|
|
50
57
|
|
|
58
|
+
Catamaran::Formatter.reset
|
|
59
|
+
|
|
51
60
|
# Resetting Catamaran probably should not reset the output settings
|
|
52
61
|
# self.send( :_stdout_flag=, nil )
|
|
53
62
|
# self.send( :_stderr_flag=, nil )
|
data/lib/catamaran/version.rb
CHANGED
data/lib/catamaran.rb
CHANGED
|
@@ -12,7 +12,7 @@ Catamaran.logger.log_level = Catamaran::LogLevel::DEBUG
|
|
|
12
12
|
Catamaran::Manager.formatter_caller_enabled = true
|
|
13
13
|
|
|
14
14
|
# Uncomment if you'd prefer Ruby-style delimiters
|
|
15
|
-
Catamaran::Manager.delimiter = '::'
|
|
15
|
+
# Catamaran::Manager.delimiter = '::'
|
|
16
16
|
|
|
17
17
|
# Uncomment to enable Catamaran internal debugging
|
|
18
18
|
# Catamaran::debugging = true
|
|
@@ -7,3 +7,9 @@
|
|
|
7
7
|
# Uncomment to disable stderr and enable stdout output
|
|
8
8
|
# Catamaran::Manager.stderr = false
|
|
9
9
|
# Catamaran::Manager.stdout = true
|
|
10
|
+
|
|
11
|
+
# Perhaps you'd like to change the log formatter pattern
|
|
12
|
+
# This is the default (Favorite Pattern #1)
|
|
13
|
+
# Catamaran::Manager.formatter_pattern = "%-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m"
|
|
14
|
+
# Favorite Pattern #2
|
|
15
|
+
# Catamaran::Manager.formatter_pattern = "%c pid-%P [%d] %p - %m"
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Catamaran::Formatter do
|
|
4
|
+
before(:each){ Catamaran::Formatter.caller_enabled = false }
|
|
5
|
+
|
|
6
|
+
let(:severity){ 7000 }
|
|
7
|
+
let(:path){ '/douglas/adams' }
|
|
8
|
+
let(:log_message){ "Don't Panic" }
|
|
9
|
+
|
|
10
|
+
context "when using a custom format pattern" do
|
|
11
|
+
context "with no options" do
|
|
12
|
+
pattern = "%c (%d) %p PID: %P | %m"
|
|
13
|
+
it "outputs the custom format" do
|
|
14
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, :pattern => pattern)
|
|
15
|
+
message.should match /^\s+ERROR\s\(.*\)\s#{path}\sPID:\s\d+\s\|\s#{log_message}$/
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
context "when a custom format pattern is not specified" do
|
|
21
|
+
it "should make use of Manager.formatter_pattern" do
|
|
22
|
+
Catamaran::Manager::formatter_pattern = "%c pid-%P [%d] %p - %m"
|
|
23
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
24
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s#{path}\s\-\s#{log_message}$/
|
|
25
|
+
|
|
26
|
+
Catamaran::Manager.reset
|
|
27
|
+
|
|
28
|
+
Catamaran::Manager::formatter_pattern = "%-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m"
|
|
29
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
30
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s\s\s\s\s\s\s\s\s\s\s+#{path}\s\-\s#{log_message}$/
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context "when using the default format" do
|
|
35
|
+
context "with no options" do
|
|
36
|
+
it "outputs the default format of %-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m" do
|
|
37
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
38
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s+#{path}\s\-\s#{log_message}$/
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context "with caller detail specified" do
|
|
43
|
+
let(:opts){ {:file => "adams", :line => 42, :class => "Ford::Prefect", :method => "make_tea"} }
|
|
44
|
+
|
|
45
|
+
it "outputs the default format with extra information" do
|
|
46
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
47
|
+
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:class]}\.#{opts[:method]}\'\)$/
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context "with incomplete caller detail specified" do
|
|
52
|
+
let(:opts){ {:file => "adams", :line => 42, :class => "Ford::Prefect", :method => "make_tea"} }
|
|
53
|
+
|
|
54
|
+
it "no file, outputs the default format without extra information" do
|
|
55
|
+
opts.delete :file
|
|
56
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
57
|
+
message.should match /^\s+ERROR\spid\-\d+\s\[.*\]\s+#{path}\s\-\s#{log_message}$/
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "no line number, outputs extra information without the line number" do
|
|
61
|
+
opts.delete :line
|
|
62
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
63
|
+
message.should match /#{log_message}\s\(#{opts[:file]}:in \`#{opts[:class]}\.#{opts[:method]}\'\)$/
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "no class, outputs extra information without the class" do
|
|
67
|
+
opts.delete :class
|
|
68
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
69
|
+
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:method]}\'\)$/
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "no method, outputs extra information without the method" do
|
|
73
|
+
opts.delete :method
|
|
74
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
75
|
+
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}:in \`#{opts[:class]}\.'\)$/
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "no class and no method, extra information without the class and method" do
|
|
79
|
+
opts.delete :method
|
|
80
|
+
opts.delete :class
|
|
81
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
82
|
+
message.should match /#{log_message}\s\(#{opts[:file]}:#{opts[:line]}\)$/
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
context "without caller detail specified, but caller information enabled" do
|
|
87
|
+
it "outputs the default format with derived caller information" do
|
|
88
|
+
Catamaran::Formatter.caller_enabled = true
|
|
89
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, {} )
|
|
90
|
+
message.should match /#{log_message}\s\(.*\)/
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
context "with the backtrace option specified" do
|
|
95
|
+
let(:opts){ {:backtrace => true } }
|
|
96
|
+
|
|
97
|
+
it "outputs the default format with a backtrace" do
|
|
98
|
+
message = Catamaran::Formatter.construct_formatted_message( severity, path, log_message, opts)
|
|
99
|
+
message.should match /#{log_message}\sfrom:\n.+/
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Catamaran::Manager do
|
|
4
|
+
describe ".formatter_pattern" do
|
|
5
|
+
it "should be of the format \"%-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m\"" do
|
|
6
|
+
Catamaran::Manager.formatter_pattern.should == "%-6p pid-%pid [%d{yyyy-M-d HH:mm:ss:SSS}] %47C - %m"
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: catamaran
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeano
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2014-01-
|
|
12
|
+
date: 2014-01-28 00:00:00 -06:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -50,6 +50,8 @@ files:
|
|
|
50
50
|
- lib/generators/catamaran/templates/catamaran/staging.rb
|
|
51
51
|
- lib/generators/catamaran/templates/catamaran/test.rb
|
|
52
52
|
- spec/catamaran_spec.rb
|
|
53
|
+
- spec/formatter_spec.rb
|
|
54
|
+
- spec/manager_spec.rb
|
|
53
55
|
- spec/spec_helper.rb
|
|
54
56
|
has_rdoc: true
|
|
55
57
|
homepage: http://github.com/jgithub/catamaran
|