catamaran 2.0.0 → 2.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7b2c5c9d0ea8b6039c9b7bc454f66f07b064541
4
- data.tar.gz: 966f7e9d3572846d188aae5deed8b1d8e2625e7a
3
+ metadata.gz: b7cd46193a36dacdc5ed0f8c6ce8c95c0a81e256
4
+ data.tar.gz: 80e278d4ebd3d9c8640809aa0748e36ace294322
5
5
  SHA512:
6
- metadata.gz: 9626247cabacf4e5497f30c4ddf2569813e4f1cee7434a0c61d0e4b4f3187de8d4fb8cbe99bbb2613177efbcebc10b3509bbd86a3f50171c585685563a9832df
7
- data.tar.gz: 6789d578205007d3fba391a95919ed1a86a84f281d6b3944c4a78a6b4e546332e5dde76658df4a4387d9eff428706f2e900419b43fc69dfa52eba83ef2a4e1ad
6
+ metadata.gz: bbb1d0824624d9f21ccb207c27a05ec0dd20132a8a2bd7f77d34971a579aa6cd05cb53a4610500d2296047d535819d974872923ce0d5fcacf3f8bc6d848de12c
7
+ data.tar.gz: d51f7a5b1e9cb1295b431baec9280c701557ecdf550e942937a85694588e48dbfcc5a9f2d16fa9cba8f0683aa3e208f672c79a76a1f9e695991d0feb208d18b5
data/README.md CHANGED
@@ -6,7 +6,7 @@ Logging is a powerful and often undervalued tool in software development. When
6
6
  Gemfile
7
7
  -------
8
8
 
9
- gem 'catamaran', '~> 2.0.0'
9
+ gem 'catamaran', '~> 2.1.0'
10
10
 
11
11
  Rails-related setup:
12
12
 
@@ -79,17 +79,17 @@ working_with_catamaran.displaying_backtrace_information
79
79
  And the output
80
80
 
81
81
  ```
82
- NOTICE pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - NOTICE logs are captured by default
83
- WARN pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - WARN logs are captured by default
84
- ERROR pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - ERROR logs are captured by default
85
- SEVERE pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - SEVERE logs are captured by default
86
- FATAL pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - FATAL logs are captured by default
87
- NOTICE pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - The caller will append log location info to this message (working_with_catamaran.rb:27:in `using_the_caller')
88
- NOTICE pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - If the user specifies the :file, :line, AND :method, the caller will NOT get invoked (working_with_catamaran.rb:28:in `run')
89
- NOTICE pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - To prove the caller is not used, we can put dummy data in and see that it's being used instead (just_kidding.rb:123456789:in `whatever')
90
- DEBUG pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - Now DEBUG messages should show up
91
- WARN pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - Sample WARN statement with backtrace requested
92
- ERROR pid-28828 [2014-01-04 15:42:18:664] com.mytld.WorkingWithCatamaran - Sample ERROR statement with backtrace requested from:
82
+ NOTICE pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - NOTICE logs are captured by default
83
+ WARN pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - WARN logs are captured by default
84
+ ERROR pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - ERROR logs are captured by default
85
+ SEVERE pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - SEVERE logs are captured by default
86
+ FATAL pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - FATAL logs are captured by default
87
+ NOTICE pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - The caller will append log location info to this message (working_with_catamaran.rb:27:in `using_the_caller')
88
+ NOTICE pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - If the user specifies the :file, :line, AND :method, the caller will NOT get invoked (working_with_catamaran.rb:28:in `run')
89
+ NOTICE pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - To prove the caller is not used, we can put dummy data in and see that it's being used instead (just_kidding.rb:123456789:in `whatever')
90
+ DEBUG pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - Now DEBUG messages should show up
91
+ WARN pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - Sample WARN statement with backtrace requested
92
+ ERROR pid-29665 [2014-01-05 08:30:24:213] com.mytld.WorkingWithCatamaran - Sample ERROR statement with backtrace requested from:
93
93
  working_with_catamaran.rb:51:in `displaying_backtrace_information'
94
94
  working_with_catamaran.rb:59:in `<main>'
95
95
  ```
@@ -312,188 +312,182 @@ printer.print(STDOUT)
312
312
 
313
313
  ```
314
314
  Thread ID: 2156341060
315
- Fiber ID: 2156558900
316
- Total Time: 0.792647
315
+ Fiber ID: 2160266620
316
+ Total Time: 0.744246
317
317
  Sort by: total_time
318
318
 
319
319
  %total %self total self wait child calls Name
320
320
  --------------------------------------------------------------------------------
321
- 100.00% 0.01% 0.793 0.000 0.000 0.793 1 Global#[No method]
322
- 0.793 0.003 0.000 0.790 1/1 Integer#times
323
- 0.000 0.000 0.000 0.000 1/2 Class#new
324
- --------------------------------------------------------------------------------
325
- 0.793 0.003 0.000 0.790 1/1 Global#[No method]
326
- 99.99% 0.36% 0.793 0.003 0.000 0.790 1 Integer#times
327
- 0.790 0.021 0.000 0.768 1000/1000 ProfilerTest#run
328
- --------------------------------------------------------------------------------
329
- 0.790 0.021 0.000 0.768 1000/1000 Integer#times
330
- 99.64% 2.70% 0.790 0.021 0.000 0.768 1000 ProfilerTest#run
331
- 0.147 0.012 0.000 0.135 1000/1000 Catamaran::Logger#severe
332
- 0.146 0.007 0.000 0.138 1000/1000 Catamaran::Logger#fatal
333
- 0.144 0.007 0.000 0.137 1000/1000 Catamaran::Logger#error
334
- 0.140 0.007 0.000 0.133 1000/1000 Catamaran::Logger#warn
335
- 0.128 0.007 0.000 0.122 1000/1000 Catamaran::Logger#notice
321
+ 100.00% 0.01% 0.744 0.000 0.000 0.744 1 Global#[No method]
322
+ 0.744 0.003 0.000 0.741 1/1 Integer#times
323
+ 0.000 0.000 0.000 0.000 1/1 Class#new
324
+ --------------------------------------------------------------------------------
325
+ 0.744 0.003 0.000 0.741 1/1 Global#[No method]
326
+ 99.99% 0.38% 0.744 0.003 0.000 0.741 1 Integer#times
327
+ 0.741 0.021 0.000 0.720 1000/1000 ProfilerTest#run
328
+ --------------------------------------------------------------------------------
329
+ 0.741 0.021 0.000 0.720 1000/1000 Integer#times
330
+ 99.61% 2.85% 0.741 0.021 0.000 0.720 1000 ProfilerTest#run
331
+ 0.136 0.007 0.000 0.129 1000/1000 Catamaran::Logger#severe
332
+ 0.136 0.007 0.000 0.128 1000/1000 Catamaran::Logger#fatal
333
+ 0.132 0.007 0.000 0.124 1000/1000 Catamaran::Logger#error
334
+ 0.130 0.007 0.000 0.123 1000/1000 Catamaran::Logger#warn
335
+ 0.122 0.006 0.000 0.115 1000/1000 Catamaran::Logger#notice
336
+ 0.025 0.009 0.000 0.015 1000/1000 Catamaran::Logger#trace?
336
337
  0.021 0.006 0.000 0.015 1000/1000 Catamaran::Logger#debug?
337
- 0.021 0.006 0.000 0.015 1000/1000 Catamaran::Logger#trace?
338
- 0.021 0.006 0.000 0.015 1000/1000 Catamaran::Logger#info?
339
- --------------------------------------------------------------------------------
340
- 0.107 0.006 0.000 0.100 1000/5000 Catamaran::Logger#notice
341
- 0.119 0.007 0.000 0.113 1000/5000 Catamaran::Logger#warn
342
- 0.120 0.007 0.000 0.113 1000/5000 Catamaran::Logger#severe
343
- 0.121 0.007 0.000 0.115 1000/5000 Catamaran::Logger#error
344
- 0.123 0.007 0.000 0.117 1000/5000 Catamaran::Logger#fatal
345
- 74.54% 4.23% 0.591 0.034 0.000 0.557 5000 Catamaran::Logger#log
346
- 0.381 0.028 0.000 0.353 5000/5000 Catamaran::Logger#_format_msg
347
- 0.176 0.047 0.000 0.129 5000/5000 <Class::Catamaran::Outputter>#write
348
- --------------------------------------------------------------------------------
349
- 0.381 0.028 0.000 0.353 5000/5000 Catamaran::Logger#log
350
- 48.08% 3.49% 0.381 0.028 0.000 0.353 5000 Catamaran::Logger#_format_msg
351
- 0.288 0.107 0.000 0.181 5000/5000 Catamaran::Formatter#construct_formatted_message
352
- 0.051 0.033 0.000 0.018 5000/5000 Catamaran::Logger#path_to_s
353
- 0.014 0.014 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#instance
354
- --------------------------------------------------------------------------------
355
- 0.288 0.107 0.000 0.181 5000/5000 Catamaran::Logger#_format_msg
356
- 36.32% 13.50% 0.288 0.107 0.000 0.181 5000 Catamaran::Formatter#construct_formatted_message
357
- 0.086 0.064 0.000 0.022 5000/5000 Time#strftime
358
- 0.038 0.018 0.000 0.020 5000/5000 <Class::Time>#now
359
- 0.025 0.025 0.000 0.000 5000/5000 Kernel#sprintf
338
+ 0.020 0.005 0.000 0.015 1000/1000 Catamaran::Logger#info?
339
+ --------------------------------------------------------------------------------
340
+ 0.101 0.006 0.000 0.095 1000/5000 Catamaran::Logger#notice
341
+ 0.109 0.006 0.000 0.102 1000/5000 Catamaran::Logger#error
342
+ 0.109 0.007 0.000 0.102 1000/5000 Catamaran::Logger#warn
343
+ 0.113 0.007 0.000 0.107 1000/5000 Catamaran::Logger#fatal
344
+ 0.115 0.007 0.000 0.108 1000/5000 Catamaran::Logger#severe
345
+ 73.47% 4.35% 0.547 0.032 0.000 0.514 5000 Catamaran::Logger#log
346
+ 0.360 0.021 0.000 0.339 5000/5000 Catamaran::Logger#_format_msg
347
+ 0.155 0.058 0.000 0.096 5000/5000 <Class::Catamaran::Outputter>#write
348
+ --------------------------------------------------------------------------------
349
+ 0.360 0.021 0.000 0.339 5000/5000 Catamaran::Logger#log
350
+ 48.36% 2.87% 0.360 0.021 0.000 0.339 5000 Catamaran::Logger#_format_msg
351
+ 0.287 0.105 0.000 0.182 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
352
+ 0.052 0.032 0.000 0.020 5000/5000 Catamaran::Logger#path_to_s
353
+ --------------------------------------------------------------------------------
354
+ 0.287 0.105 0.000 0.182 5000/5000 Catamaran::Logger#_format_msg
355
+ 38.53% 14.11% 0.287 0.105 0.000 0.182 5000 <Class::Catamaran::Formatter>#construct_formatted_message
356
+ 0.086 0.065 0.000 0.021 5000/5000 Time#strftime
357
+ 0.036 0.016 0.000 0.019 5000/5000 <Class::Time>#now
358
+ 0.029 0.029 0.000 0.000 5000/5000 Kernel#sprintf
360
359
  0.014 0.014 0.000 0.000 5000/5000 <Class::Catamaran::LogLevel>#severity_to_s
361
360
  0.011 0.011 0.000 0.000 5000/5000 Fixnum#to_s
362
361
  0.006 0.006 0.000 0.000 5000/5000 <Module::Process>#pid
363
362
  --------------------------------------------------------------------------------
364
- 0.176 0.047 0.000 0.129 5000/5000 Catamaran::Logger#log
365
- 22.23% 5.96% 0.176 0.047 0.000 0.129 5000 <Class::Catamaran::Outputter>#write
366
- 0.095 0.020 0.000 0.075 5000/5000 IO#puts
367
- 0.018 0.018 0.000 0.000 5000/5000 <Class::Catamaran::Manager>#stdout?
368
- 0.016 0.016 0.000 0.000 5000/5000 <Class::Catamaran::Manager>#stderr?
369
- --------------------------------------------------------------------------------
370
- 0.147 0.012 0.000 0.135 1000/1000 ProfilerTest#run
371
- 18.53% 1.54% 0.147 0.012 0.000 0.135 1000 Catamaran::Logger#severe
372
- 0.120 0.007 0.000 0.113 1000/5000 Catamaran::Logger#log
363
+ 0.155 0.058 0.000 0.096 5000/5000 Catamaran::Logger#log
364
+ 20.76% 7.85% 0.155 0.058 0.000 0.096 5000 <Class::Catamaran::Outputter>#write
365
+ 0.085 0.020 0.000 0.066 5000/5000 IO#puts
366
+ 0.011 0.011 0.000 0.000 9998/25999 Kernel#nil?
367
+ 0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#stdout?
368
+ 0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#stderr?
369
+ 0.000 0.000 0.000 0.000 2/6 NilClass#nil?
370
+ --------------------------------------------------------------------------------
371
+ 0.136 0.007 0.000 0.129 1000/1000 ProfilerTest#run
372
+ 18.29% 0.92% 0.136 0.007 0.000 0.129 1000 Catamaran::Logger#severe
373
+ 0.115 0.007 0.000 0.108 1000/5000 Catamaran::Logger#log
373
374
  0.015 0.012 0.000 0.002 1000/8003 Catamaran::Logger#log_level
374
375
  --------------------------------------------------------------------------------
375
- 0.146 0.007 0.000 0.138 1000/1000 ProfilerTest#run
376
- 18.39% 0.94% 0.146 0.007 0.000 0.138 1000 Catamaran::Logger#fatal
377
- 0.123 0.007 0.000 0.117 1000/5000 Catamaran::Logger#log
376
+ 0.136 0.007 0.000 0.128 1000/1000 ProfilerTest#run
377
+ 18.26% 1.00% 0.136 0.007 0.000 0.128 1000 Catamaran::Logger#fatal
378
+ 0.113 0.007 0.000 0.107 1000/5000 Catamaran::Logger#log
378
379
  0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
379
380
  --------------------------------------------------------------------------------
380
- 0.144 0.007 0.000 0.137 1000/1000 ProfilerTest#run
381
- 18.20% 0.94% 0.144 0.007 0.000 0.137 1000 Catamaran::Logger#error
382
- 0.121 0.007 0.000 0.115 1000/5000 Catamaran::Logger#log
381
+ 0.132 0.007 0.000 0.124 1000/1000 ProfilerTest#run
382
+ 17.68% 0.96% 0.132 0.007 0.000 0.124 1000 Catamaran::Logger#error
383
+ 0.109 0.006 0.000 0.102 1000/5000 Catamaran::Logger#log
383
384
  0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
384
385
  --------------------------------------------------------------------------------
385
- 0.140 0.007 0.000 0.133 1000/1000 ProfilerTest#run
386
- 17.64% 0.85% 0.140 0.007 0.000 0.133 1000 Catamaran::Logger#warn
387
- 0.119 0.007 0.000 0.113 1000/5000 Catamaran::Logger#log
386
+ 0.130 0.007 0.000 0.123 1000/1000 ProfilerTest#run
387
+ 17.41% 0.90% 0.130 0.007 0.000 0.123 1000 Catamaran::Logger#warn
388
+ 0.109 0.007 0.000 0.102 1000/5000 Catamaran::Logger#log
388
389
  0.014 0.012 0.000 0.002 1000/8003 Catamaran::Logger#log_level
389
390
  --------------------------------------------------------------------------------
390
- 0.128 0.007 0.000 0.122 1000/1000 ProfilerTest#run
391
- 16.19% 0.84% 0.128 0.007 0.000 0.122 1000 Catamaran::Logger#notice
392
- 0.107 0.006 0.000 0.100 1000/5000 Catamaran::Logger#log
393
- 0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
391
+ 0.122 0.006 0.000 0.115 1000/1000 ProfilerTest#run
392
+ 16.34% 0.87% 0.122 0.006 0.000 0.115 1000 Catamaran::Logger#notice
393
+ 0.101 0.006 0.000 0.095 1000/5000 Catamaran::Logger#log
394
+ 0.014 0.012 0.000 0.002 1000/8003 Catamaran::Logger#log_level
394
395
  --------------------------------------------------------------------------------
395
396
  0.000 0.000 0.000 0.000 3/8003 Catamaran::Logger#log_level
396
397
  0.014 0.012 0.000 0.002 1000/8003 Catamaran::Logger#warn
398
+ 0.014 0.012 0.000 0.002 1000/8003 Catamaran::Logger#notice
397
399
  0.015 0.012 0.000 0.002 1000/8003 Catamaran::Logger#severe
398
- 0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#notice
400
+ 0.015 0.012 0.000 0.002 1000/8003 Catamaran::Logger#info?
401
+ 0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#debug?
399
402
  0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#fatal
400
- 0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#info?
401
403
  0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#trace?
402
- 0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#debug?
403
404
  0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#error
404
- 15.07% 12.83% 0.119 0.102 0.000 0.018 8003 *Catamaran::Logger#log_level
405
- 0.018 0.018 0.000 0.000 16001/16001 Kernel#nil?
406
- 0.000 0.000 0.000 0.000 4/4 NilClass#nil?
405
+ 15.87% 13.54% 0.118 0.101 0.000 0.017 8003 *Catamaran::Logger#log_level
406
+ 0.017 0.017 0.000 0.000 16001/25999 Kernel#nil?
407
+ 0.000 0.000 0.000 0.000 4/6 NilClass#nil?
407
408
  0.000 0.000 0.000 0.000 3/8003 Catamaran::Logger#log_level
408
409
  --------------------------------------------------------------------------------
409
- 0.095 0.020 0.000 0.075 5000/5000 <Class::Catamaran::Outputter>#write
410
- 11.98% 2.49% 0.095 0.020 0.000 0.075 5000 IO#puts
411
- 0.075 0.075 0.000 0.000 10000/10000 IO#write
412
- --------------------------------------------------------------------------------
413
- 0.086 0.064 0.000 0.022 5000/5000 Catamaran::Formatter#construct_formatted_message
414
- 10.89% 8.09% 0.086 0.064 0.000 0.022 5000 Time#strftime
415
- 0.016 0.016 0.000 0.000 10000/10000 Fixnum#divmod
410
+ 0.086 0.065 0.000 0.021 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
411
+ 11.58% 8.69% 0.086 0.065 0.000 0.021 5000 Time#strftime
412
+ 0.015 0.015 0.000 0.000 10000/10000 Fixnum#divmod
416
413
  0.006 0.006 0.000 0.000 5000/5000 Fixnum#%
417
414
  --------------------------------------------------------------------------------
418
- 0.075 0.075 0.000 0.000 10000/10000 IO#puts
419
- 9.49% 9.49% 0.075 0.075 0.000 0.000 10000 IO#write
415
+ 0.085 0.020 0.000 0.066 5000/5000 <Class::Catamaran::Outputter>#write
416
+ 11.46% 2.63% 0.085 0.020 0.000 0.066 5000 IO#puts
417
+ 0.066 0.066 0.000 0.000 10000/10000 IO#write
418
+ --------------------------------------------------------------------------------
419
+ 0.066 0.066 0.000 0.000 10000/10000 IO#puts
420
+ 8.84% 8.84% 0.066 0.066 0.000 0.000 10000 IO#write
420
421
  --------------------------------------------------------------------------------
421
- 0.051 0.033 0.000 0.018 5000/5000 Catamaran::Logger#_format_msg
422
- 6.49% 4.20% 0.051 0.033 0.000 0.018 5000 Catamaran::Logger#path_to_s
423
- 0.018 0.018 0.000 0.000 5000/5000 Array#join
422
+ 0.052 0.032 0.000 0.020 5000/5000 Catamaran::Logger#_format_msg
423
+ 6.96% 4.28% 0.052 0.032 0.000 0.020 5000 Catamaran::Logger#path_to_s
424
+ 0.020 0.020 0.000 0.000 5000/5000 Array#join
424
425
  0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#delimiter
425
426
  --------------------------------------------------------------------------------
426
- 0.038 0.018 0.000 0.020 5000/5000 Catamaran::Formatter#construct_formatted_message
427
- 4.78% 2.22% 0.038 0.018 0.000 0.020 5000 <Class::Time>#now
428
- 0.020 0.014 0.000 0.006 5000/5000 Time#initialize
427
+ 0.036 0.016 0.000 0.019 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
428
+ 4.77% 2.19% 0.036 0.016 0.000 0.019 5000 <Class::Time>#now
429
+ 0.019 0.013 0.000 0.006 5000/5000 Time#initialize
429
430
  --------------------------------------------------------------------------------
430
- 0.025 0.025 0.000 0.000 5000/5000 Catamaran::Formatter#construct_formatted_message
431
- 3.15% 3.15% 0.025 0.025 0.000 0.000 5000 Kernel#sprintf
431
+ 0.029 0.029 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
432
+ 3.92% 3.92% 0.029 0.029 0.000 0.000 5000 Kernel#sprintf
432
433
  --------------------------------------------------------------------------------
433
- 0.021 0.006 0.000 0.015 1000/1000 ProfilerTest#run
434
- 2.70% 0.75% 0.021 0.006 0.000 0.015 1000 Catamaran::Logger#debug?
435
- 0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
434
+ 0.011 0.011 0.000 0.000 9998/25999 <Class::Catamaran::Outputter>#write
435
+ 0.017 0.017 0.000 0.000 16001/25999 Catamaran::Logger#log_level
436
+ 3.77% 3.77% 0.028 0.028 0.000 0.000 25999 Kernel#nil?
436
437
  --------------------------------------------------------------------------------
437
- 0.021 0.006 0.000 0.015 1000/1000 ProfilerTest#run
438
- 2.69% 0.77% 0.021 0.006 0.000 0.015 1000 Catamaran::Logger#trace?
438
+ 0.025 0.009 0.000 0.015 1000/1000 ProfilerTest#run
439
+ 3.31% 1.26% 0.025 0.009 0.000 0.015 1000 Catamaran::Logger#trace?
439
440
  0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
440
441
  --------------------------------------------------------------------------------
441
442
  0.021 0.006 0.000 0.015 1000/1000 ProfilerTest#run
442
- 2.60% 0.70% 0.021 0.006 0.000 0.015 1000 Catamaran::Logger#info?
443
+ 2.78% 0.77% 0.021 0.006 0.000 0.015 1000 Catamaran::Logger#debug?
443
444
  0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
444
445
  --------------------------------------------------------------------------------
445
- 0.020 0.014 0.000 0.006 5000/5000 <Class::Time>#now
446
- 2.56% 1.80% 0.020 0.014 0.000 0.006 5000 Time#initialize
447
- 0.006 0.006 0.000 0.000 5000/5000 Fixnum#+
448
- --------------------------------------------------------------------------------
449
- 0.018 0.018 0.000 0.000 5000/5000 <Class::Catamaran::Outputter>#write
450
- 2.31% 2.31% 0.018 0.018 0.000 0.000 5000 <Class::Catamaran::Manager>#stdout?
451
- --------------------------------------------------------------------------------
452
- 0.018 0.018 0.000 0.000 5000/5000 Catamaran::Logger#path_to_s
453
- 2.28% 2.28% 0.018 0.018 0.000 0.000 5000 Array#join
446
+ 0.020 0.005 0.000 0.015 1000/1000 ProfilerTest#run
447
+ 2.70% 0.74% 0.020 0.005 0.000 0.015 1000 Catamaran::Logger#info?
448
+ 0.015 0.012 0.000 0.002 1000/8003 Catamaran::Logger#log_level
454
449
  --------------------------------------------------------------------------------
455
- 0.018 0.018 0.000 0.000 16001/16001 Catamaran::Logger#log_level
456
- 2.24% 2.24% 0.018 0.018 0.000 0.000 16001 Kernel#nil?
450
+ 0.020 0.020 0.000 0.000 5000/5000 Catamaran::Logger#path_to_s
451
+ 2.67% 2.67% 0.020 0.020 0.000 0.000 5000 Array#join
457
452
  --------------------------------------------------------------------------------
458
- 0.016 0.016 0.000 0.000 10000/10000 Time#strftime
459
- 1.99% 1.99% 0.016 0.016 0.000 0.000 10000 Fixnum#divmod
453
+ 0.019 0.013 0.000 0.006 5000/5000 <Class::Time>#now
454
+ 2.58% 1.80% 0.019 0.013 0.000 0.006 5000 Time#initialize
455
+ 0.006 0.006 0.000 0.000 5000/5000 Fixnum#+
460
456
  --------------------------------------------------------------------------------
461
- 0.016 0.016 0.000 0.000 5000/5000 <Class::Catamaran::Outputter>#write
462
- 1.97% 1.97% 0.016 0.016 0.000 0.000 5000 <Class::Catamaran::Manager>#stderr?
457
+ 0.015 0.015 0.000 0.000 10000/10000 Time#strftime
458
+ 2.06% 2.06% 0.015 0.015 0.000 0.000 10000 Fixnum#divmod
463
459
  --------------------------------------------------------------------------------
464
- 0.014 0.014 0.000 0.000 5000/5000 Catamaran::Formatter#construct_formatted_message
465
- 1.79% 1.79% 0.014 0.014 0.000 0.000 5000 <Class::Catamaran::LogLevel>#severity_to_s
460
+ 0.014 0.014 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
461
+ 1.82% 1.82% 0.014 0.014 0.000 0.000 5000 <Class::Catamaran::LogLevel>#severity_to_s
466
462
  --------------------------------------------------------------------------------
467
- 0.014 0.014 0.000 0.000 5000/5000 Catamaran::Logger#_format_msg
468
- 1.78% 1.78% 0.014 0.014 0.000 0.000 5000 <Class::Catamaran::Formatter>#instance
469
- 0.000 0.000 0.000 0.000 1/2 Class#new
463
+ 0.011 0.011 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
464
+ 1.48% 1.48% 0.011 0.011 0.000 0.000 5000 Fixnum#to_s
470
465
  --------------------------------------------------------------------------------
471
- 0.011 0.011 0.000 0.000 5000/5000 Catamaran::Formatter#construct_formatted_message
472
- 1.44% 1.44% 0.011 0.011 0.000 0.000 5000 Fixnum#to_s
466
+ 0.006 0.006 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
467
+ 0.84% 0.84% 0.006 0.006 0.000 0.000 5000 <Module::Process>#pid
473
468
  --------------------------------------------------------------------------------
474
469
  0.006 0.006 0.000 0.000 5000/5000 Time#strftime
475
- 0.81% 0.81% 0.006 0.006 0.000 0.000 5000 Fixnum#%
476
- --------------------------------------------------------------------------------
477
- 0.006 0.006 0.000 0.000 5000/5000 Catamaran::Formatter#construct_formatted_message
478
- 0.77% 0.77% 0.006 0.006 0.000 0.000 5000 <Module::Process>#pid
470
+ 0.82% 0.82% 0.006 0.006 0.000 0.000 5000 Fixnum#%
479
471
  --------------------------------------------------------------------------------
480
472
  0.006 0.006 0.000 0.000 5000/5000 Time#initialize
481
- 0.76% 0.76% 0.006 0.006 0.000 0.000 5000 Fixnum#+
473
+ 0.78% 0.78% 0.006 0.006 0.000 0.000 5000 Fixnum#+
482
474
  --------------------------------------------------------------------------------
483
- 0.000 0.000 0.000 0.000 1/2 Global#[No method]
484
- 0.000 0.000 0.000 0.000 1/2 <Class::Catamaran::Formatter>#instance
485
- 0.00% 0.00% 0.000 0.000 0.000 0.000 2 Class#new
486
- 0.000 0.000 0.000 0.000 1/1 Catamaran::Formatter#initialize
475
+ 0.000 0.000 0.000 0.000 2/6 <Class::Catamaran::Outputter>#write
476
+ 0.000 0.000 0.000 0.000 4/6 Catamaran::Logger#log_level
477
+ 0.00% 0.00% 0.000 0.000 0.000 0.000 6 NilClass#nil?
478
+ --------------------------------------------------------------------------------
479
+ 0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Outputter>#write
480
+ 0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#stdout?
481
+ --------------------------------------------------------------------------------
482
+ 0.000 0.000 0.000 0.000 1/1 Global#[No method]
483
+ 0.00% 0.00% 0.000 0.000 0.000 0.000 1 Class#new
487
484
  0.000 0.000 0.000 0.000 1/1 BasicObject#initialize
485
+ --------------------------------------------------------------------------------
486
+ 0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Outputter>#write
487
+ 0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#stderr?
488
488
  --------------------------------------------------------------------------------
489
489
  0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#path_to_s
490
490
  0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#delimiter
491
- --------------------------------------------------------------------------------
492
- 0.000 0.000 0.000 0.000 4/4 Catamaran::Logger#log_level
493
- 0.00% 0.00% 0.000 0.000 0.000 0.000 4 NilClass#nil?
494
- --------------------------------------------------------------------------------
495
- 0.000 0.000 0.000 0.000 1/1 Class#new
496
- 0.00% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Formatter#initialize
497
491
  --------------------------------------------------------------------------------
498
492
  0.000 0.000 0.000 0.000 1/1 Class#new
499
493
  0.00% 0.00% 0.000 0.000 0.000 0.000 1 BasicObject#initialize
@@ -506,7 +500,7 @@ Sort by: total_time
506
500
  Ideas around what's next
507
501
  ------------------------
508
502
 
509
- * Make it easier to change the formatting pattern
503
+ * Make it easier to change the formatting pattern (Perhaps support for something similar to this: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html?)
510
504
  * Another iteration of improvements on logger.io
511
505
  * Consider capturing log messages beyond stderr, stdout, and local files
512
506
  * Ongoing performance considerations
@@ -1,24 +1,21 @@
1
1
  module Catamaran
2
- class Formatter
3
- include Singleton
2
+ class Formatter
3
+ # Using caller() in the log messages is DISABLED by default
4
+ @@caller_enabled = false
4
5
 
5
- def self.instance
6
- @@instance ||= new
7
- end
8
-
9
- def caller_enabled=( boolean_value )
10
- @caller_enabled = boolean_value
6
+ def self.caller_enabled=( boolean_value )
7
+ @@caller_enabled = boolean_value
11
8
  end
12
9
 
13
- def caller_enabled
14
- @caller_enabled
10
+ def self.caller_enabled
11
+ @@caller_enabled
15
12
  end
16
13
 
17
14
  ##
18
15
  # Construct a properly formatted log message based
19
16
 
20
17
 
21
- def construct_formatted_message( severity, path, msg, opts )
18
+ def self.construct_formatted_message( severity, path, msg, opts )
22
19
  msg = sprintf( "%6s pid-#{Process.pid} [#{Time.now.strftime( "%G-%m-%d %H:%M:%S:%L" )}] %47s - #{msg}",
23
20
  LogLevel.severity_to_s( severity ),
24
21
  ( path.length > 47 ) ? path.dup[-47,47] : path )
@@ -28,11 +25,11 @@ module Catamaran
28
25
  ##
29
26
  # Should the caller component be added to the msg
30
27
 
31
- if ( ( opts && opts[:file] && opts[:line] && opts[:method] ) || !@caller_enabled )
28
+ if ( ( opts && opts[:file] && opts[:line] && opts[:method] ) || !@@caller_enabled )
32
29
  # if file and line number are specified or the caller_enabled is disabled
33
30
  # then construct a formatted message that does NOT make use of the caller (caller is slow)
34
31
  append_caller_information = false
35
- elsif @caller_enabled
32
+ elsif @@caller_enabled
36
33
  # else if the caller is enabled, make use of it
37
34
  append_caller_information = true
38
35
  else
@@ -86,14 +83,6 @@ module Catamaran
86
83
  # Implicit return
87
84
  msg
88
85
  end
89
-
90
- private
91
-
92
- def initialize
93
- # Using caller() in the log messages is DISABLED by default
94
- @caller_enabled = false
95
- end
96
-
97
86
  end
98
87
  end
99
88
 
@@ -538,7 +538,7 @@ module Catamaran
538
538
  end
539
539
 
540
540
  if opts && opts[:backtrace] == true
541
- _smart_backtrace_log_level = self.smart_backtrace_log_level()
541
+ _smart_backtrace_log_level = self.backtrace_log_level( { :recursive => true } )
542
542
 
543
543
  # If the specified log message has a level that's
544
544
  # greater than or equal to the current backtrace_log_level
@@ -566,7 +566,7 @@ module Catamaran
566
566
 
567
567
  def _format_msg( severity, msg, opts )
568
568
  # Implicit return
569
- Formatter.instance.construct_formatted_message( severity, self.path_to_s(), msg, opts )
569
+ Formatter.construct_formatted_message( severity, self.path_to_s(), msg, opts )
570
570
  end
571
571
 
572
572
  ##
@@ -20,12 +20,12 @@ module Catamaran
20
20
 
21
21
 
22
22
  def self.formatter_caller_enabled=( boolean_value )
23
- Catamaran::Formatter.instance.caller_enabled = boolean_value
23
+ Catamaran::Formatter.caller_enabled = boolean_value
24
24
  end
25
25
 
26
26
  def self.formatter_caller_enabled
27
27
  # Implicit return
28
- Catamaran::Formatter.instance.caller_enabled
28
+ Catamaran::Formatter.caller_enabled
29
29
  end
30
30
 
31
31
 
@@ -44,8 +44,10 @@ module Catamaran
44
44
  root_logger.reset( opts ) if root_logger
45
45
 
46
46
  # Also reset the default log level
47
- Catamaran::LogLevel::reset
47
+ Catamaran::LogLevel.reset
48
48
 
49
+ Catamaran::Outputter.reset
50
+
49
51
  # Resetting Catamaran probably should not reset the output settings
50
52
  # self.send( :_stdout_flag=, nil )
51
53
  # self.send( :_stderr_flag=, nil )
@@ -1,15 +1,18 @@
1
1
  module Catamaran
2
2
  class Outputter
3
-
4
- ##
5
- # Write the log message to the appropriate location. Currently that could mean stdout, stderr, or output files.
3
+ @@stdout = nil
4
+ @@stderr = nil
6
5
 
7
6
  def self.write( formatted_msg )
8
- if Manager.stdout?
7
+ @@stdout = Manager.stdout? if @@stdout.nil?
8
+ @@stderr = Manager.stderr? if @@stderr.nil?
9
+
10
+
11
+ if @@stdout
9
12
  $stdout.puts( formatted_msg )
10
13
  end
11
14
 
12
- if Manager.stderr?
15
+ if @@stderr
13
16
  $stderr.puts( formatted_msg )
14
17
  end
15
18
 
@@ -21,7 +24,11 @@ module Catamaran
21
24
  $stderr.puts( "Catamaran is unable to write to logfile: #{output_file}" )
22
25
  end
23
26
  end if _output_files
27
+ end
24
28
 
29
+ def self.reset
30
+ @@stdout = nil
31
+ @@stderr = nil
25
32
  end
26
33
  end
27
34
  end
@@ -1,4 +1,4 @@
1
1
  module Catamaran
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.0'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catamaran
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-04 00:00:00.000000000 Z
11
+ date: 2014-01-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A logging utility
14
14
  email: