catamaran 2.2.0 → 2.3.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 +7 -0
- data/README.md +229 -149
- data/examples/simple_benchmark.rb +62 -0
- data/examples/with_the_ruby_profiler.rb +271 -0
- data/lib/catamaran/logger.rb +198 -88
- data/lib/catamaran/version.rb +1 -1
- data/spec/catamaran_spec.rb +53 -0
- metadata +23 -33
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 1d483f668668cc6e5b3cca3ceafb382214ed6e2b
|
|
4
|
+
data.tar.gz: e7075c28252ab3b13fc25a0388d5bd66bbf787db
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ccb325161e8894c82cf68c2f1f8bf07da354b9c151f6a3930f57413e7c46f406e14ce0447c093f8093a148785f23fd76b5d50aafe68c88c05db350ceeccfcee7
|
|
7
|
+
data.tar.gz: 5477475ea64cf858a4597874c1d6aa33ca84be41fa723ade43f9fdc1c70ce3c349be1548e2926d8882faeb58f60b7eea29f785248b257bea9c8cc0cef400202f
|
data/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Catamaran
|
|
2
2
|
=========
|
|
3
3
|
|
|
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.
|
|
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
6
|
Gemfile
|
|
7
7
|
-------
|
|
8
8
|
|
|
9
|
-
gem 'catamaran', '~> 2.
|
|
9
|
+
gem 'catamaran', '~> 2.3.0'
|
|
10
10
|
|
|
11
11
|
Rails-related setup:
|
|
12
12
|
|
|
@@ -125,23 +125,17 @@ Available log levels: `TRACE` (verbose and trivial log messages), `DEBUG`, `INF
|
|
|
125
125
|
|
|
126
126
|
The `NOTICE` log level severity is the default. Any logs with `NOTICE` or higher severity will be captured.
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
I always liked working with log4j. Much of the inspriation comes from that.
|
|
128
|
+
## Why Catamaran?
|
|
129
|
+
### What I was looking for and why existing solutions didn't really work for me
|
|
131
130
|
|
|
132
|
-
* Named Hierarchy
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* captures from where each log entry was generated
|
|
141
|
-
* works equally well with classes that do and do *not* extend Rails base classes
|
|
142
|
-
* supports the TRACE log level (or other log level less critical than DEBUG).
|
|
143
|
-
* is capable of capturing logs at different severity thresholds from different parts of the app simultaneously
|
|
144
|
-
* readily works with Rails
|
|
131
|
+
* Years ago we used [log4j](http://logging.apache.org/log4j/1.2/manual.html) with Java. It worked great. It made use of Named Hierarchy and Level Inheritance which seemed well thought out.
|
|
132
|
+
* It's valuable to be able to enable verbose logging in targetted areas (but not all areas) of the application. For instance, I might want to enable verbose DEBUG logs in the models but not in the controllers. That was easy with log4j.
|
|
133
|
+
* Log messages should have graunlar timestamps (milliseconds), process IDs, and location information embedded in them. That was easy with log4j.
|
|
134
|
+
* There needs to be more than one log severity available for "debugging stuff." Some debug log statements are too verbose for every day use. log4j handled this by creating another log level, `TRACE`, that was less-critical than `DEBUG`.
|
|
135
|
+
* Many of the Ruby logging tools don't seem to put any emphasis on performance. With potentially large number of log statements being traversed on every request, I think it's a valuable consideration.
|
|
136
|
+
* I was looking for a utility that works equally well with or without Rails
|
|
137
|
+
* log4r seemed like a natural choice coming from log4j. But at the time, log4r wasn't actively being worked on. It seems they've recently restarted development.
|
|
138
|
+
* I started thinking about Ruby logging a few years ago. I wasn't aware of [TwP/logging](https://github.com/TwP/logging) until recently.
|
|
145
139
|
|
|
146
140
|
Performance Considerations
|
|
147
141
|
--------------------------
|
|
@@ -311,165 +305,248 @@ printer.print(STDOUT)
|
|
|
311
305
|
|
|
312
306
|
```
|
|
313
307
|
Thread ID: 2156341060
|
|
314
|
-
Fiber ID:
|
|
315
|
-
Total Time: 0.
|
|
308
|
+
Fiber ID: 2160160240
|
|
309
|
+
Total Time: 0.632719
|
|
316
310
|
Sort by: total_time
|
|
317
311
|
|
|
318
312
|
%total %self total self wait child calls Name
|
|
319
313
|
--------------------------------------------------------------------------------
|
|
320
|
-
100.00% 0.01% 0.
|
|
321
|
-
0.
|
|
314
|
+
100.00% 0.01% 0.633 0.000 0.000 0.633 1 Global#[No method]
|
|
315
|
+
0.633 0.003 0.000 0.630 1/1 Integer#times
|
|
322
316
|
0.000 0.000 0.000 0.000 1/1 Class#new
|
|
323
317
|
--------------------------------------------------------------------------------
|
|
324
|
-
0.
|
|
325
|
-
99.99% 0.
|
|
326
|
-
0.
|
|
327
|
-
--------------------------------------------------------------------------------
|
|
328
|
-
0.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
0.
|
|
332
|
-
0.
|
|
333
|
-
0.
|
|
334
|
-
0.
|
|
335
|
-
0.
|
|
336
|
-
0.
|
|
337
|
-
0.
|
|
338
|
-
|
|
339
|
-
0.
|
|
340
|
-
0.
|
|
341
|
-
0.
|
|
342
|
-
|
|
343
|
-
0.
|
|
344
|
-
|
|
345
|
-
0.
|
|
346
|
-
0.
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
0.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
0.
|
|
356
|
-
|
|
357
|
-
0.
|
|
318
|
+
0.633 0.003 0.000 0.630 1/1 Global#[No method]
|
|
319
|
+
99.99% 0.47% 0.633 0.003 0.000 0.630 1 Integer#times
|
|
320
|
+
0.630 0.022 0.000 0.608 1000/4000 WithTheRubyProfiler#run
|
|
321
|
+
--------------------------------------------------------------------------------
|
|
322
|
+
0.000 0.000 0.000 0.000 3000/4000 WithTheRubyProfiler#run
|
|
323
|
+
0.630 0.022 0.000 0.608 1000/4000 Integer#times
|
|
324
|
+
99.52% 3.50% 0.630 0.022 0.000 0.608 4000 *WithTheRubyProfiler#run
|
|
325
|
+
0.123 0.005 0.000 0.118 1000/2000 Catamaran::Logger#notice
|
|
326
|
+
0.120 0.006 0.000 0.115 1000/2000 Catamaran::Logger#error
|
|
327
|
+
0.120 0.006 0.000 0.114 1000/2000 Catamaran::Logger#severe
|
|
328
|
+
0.119 0.005 0.000 0.114 1000/2000 Catamaran::Logger#warn
|
|
329
|
+
0.118 0.006 0.000 0.112 1000/2000 Catamaran::Logger#fatal
|
|
330
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_trace?
|
|
331
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_info?
|
|
332
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_debug?
|
|
333
|
+
0.000 0.000 0.000 0.000 3/8 String#to_sym
|
|
334
|
+
0.000 0.000 0.000 0.000 3/8 Symbol#to_s
|
|
335
|
+
0.000 0.000 0.000 0.000 3000/4000 WithTheRubyProfiler#run
|
|
336
|
+
--------------------------------------------------------------------------------
|
|
337
|
+
0.109 0.007 0.000 0.103 1000/5000 Catamaran::Logger#fatal
|
|
338
|
+
0.111 0.006 0.000 0.105 1000/5000 Catamaran::Logger#warn
|
|
339
|
+
0.112 0.007 0.000 0.105 1000/5000 Catamaran::Logger#severe
|
|
340
|
+
0.112 0.007 0.000 0.105 1000/5000 Catamaran::Logger#error
|
|
341
|
+
0.115 0.007 0.000 0.108 1000/5000 Catamaran::Logger#notice
|
|
342
|
+
88.36% 5.32% 0.559 0.034 0.000 0.525 5000 Catamaran::Logger#log
|
|
343
|
+
0.362 0.022 0.000 0.340 5000/5000 Catamaran::Logger#_format_msg
|
|
344
|
+
0.164 0.060 0.000 0.104 5000/5000 <Class::Catamaran::Outputter>#write
|
|
345
|
+
--------------------------------------------------------------------------------
|
|
346
|
+
0.362 0.022 0.000 0.340 5000/5000 Catamaran::Logger#log
|
|
347
|
+
57.15% 3.48% 0.362 0.022 0.000 0.340 5000 Catamaran::Logger#_format_msg
|
|
348
|
+
0.289 0.102 0.000 0.187 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
349
|
+
0.051 0.033 0.000 0.018 5000/5000 Catamaran::Logger#path_to_s
|
|
350
|
+
--------------------------------------------------------------------------------
|
|
351
|
+
0.289 0.102 0.000 0.187 5000/5000 Catamaran::Logger#_format_msg
|
|
352
|
+
45.64% 16.16% 0.289 0.102 0.000 0.187 5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
353
|
+
0.091 0.069 0.000 0.022 5000/5000 Time#strftime
|
|
354
|
+
0.038 0.017 0.000 0.020 5000/5000 <Class::Time>#now
|
|
355
|
+
0.028 0.028 0.000 0.000 5000/5000 Kernel#sprintf
|
|
358
356
|
0.014 0.014 0.000 0.000 5000/5000 <Class::Catamaran::LogLevel>#severity_to_s
|
|
359
|
-
0.
|
|
360
|
-
0.
|
|
357
|
+
0.009 0.009 0.000 0.000 5000/5000 Fixnum#to_s
|
|
358
|
+
0.007 0.007 0.000 0.000 5000/5000 <Module::Process>#pid
|
|
361
359
|
--------------------------------------------------------------------------------
|
|
362
|
-
0.
|
|
363
|
-
|
|
364
|
-
0.
|
|
365
|
-
0.011 0.011 0.000 0.000 9998/
|
|
360
|
+
0.164 0.060 0.000 0.104 5000/5000 Catamaran::Logger#log
|
|
361
|
+
25.88% 9.46% 0.164 0.060 0.000 0.104 5000 <Class::Catamaran::Outputter>#write
|
|
362
|
+
0.093 0.021 0.000 0.072 5000/5000 IO#puts
|
|
363
|
+
0.011 0.011 0.000 0.000 9998/10015 Kernel#nil?
|
|
366
364
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#stdout?
|
|
367
365
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#stderr?
|
|
368
366
|
0.000 0.000 0.000 0.000 2/6 NilClass#nil?
|
|
369
367
|
--------------------------------------------------------------------------------
|
|
370
|
-
0.
|
|
371
|
-
|
|
368
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#notice
|
|
369
|
+
0.123 0.005 0.000 0.118 1000/2000 WithTheRubyProfiler#run
|
|
370
|
+
19.45% 0.87% 0.123 0.005 0.000 0.118 2000 *Catamaran::Logger#notice
|
|
372
371
|
0.115 0.007 0.000 0.108 1000/5000 Catamaran::Logger#log
|
|
373
|
-
0.
|
|
374
|
-
|
|
375
|
-
0.
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
0.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
0.
|
|
383
|
-
0.
|
|
384
|
-
|
|
385
|
-
0.
|
|
386
|
-
|
|
387
|
-
0.
|
|
388
|
-
0.
|
|
389
|
-
|
|
390
|
-
0.
|
|
391
|
-
|
|
392
|
-
0.
|
|
393
|
-
0.
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
0.
|
|
397
|
-
0.
|
|
398
|
-
|
|
399
|
-
0.
|
|
400
|
-
0.
|
|
401
|
-
0.
|
|
402
|
-
0.
|
|
403
|
-
0.
|
|
404
|
-
|
|
405
|
-
0.
|
|
406
|
-
0.
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
0.
|
|
410
|
-
|
|
372
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_notice?
|
|
373
|
+
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
374
|
+
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
375
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#notice
|
|
376
|
+
--------------------------------------------------------------------------------
|
|
377
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#error
|
|
378
|
+
0.120 0.006 0.000 0.115 1000/2000 WithTheRubyProfiler#run
|
|
379
|
+
19.00% 0.90% 0.120 0.006 0.000 0.115 2000 *Catamaran::Logger#error
|
|
380
|
+
0.112 0.007 0.000 0.105 1000/5000 Catamaran::Logger#log
|
|
381
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_error?
|
|
382
|
+
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
383
|
+
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
384
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#error
|
|
385
|
+
--------------------------------------------------------------------------------
|
|
386
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#severe
|
|
387
|
+
0.120 0.006 0.000 0.114 1000/2000 WithTheRubyProfiler#run
|
|
388
|
+
18.95% 0.89% 0.120 0.006 0.000 0.114 2000 *Catamaran::Logger#severe
|
|
389
|
+
0.112 0.007 0.000 0.105 1000/5000 Catamaran::Logger#log
|
|
390
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_severe?
|
|
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 String#to_sym
|
|
393
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#severe
|
|
394
|
+
--------------------------------------------------------------------------------
|
|
395
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#warn
|
|
396
|
+
0.119 0.005 0.000 0.114 1000/2000 WithTheRubyProfiler#run
|
|
397
|
+
18.85% 0.85% 0.119 0.005 0.000 0.114 2000 *Catamaran::Logger#warn
|
|
398
|
+
0.111 0.006 0.000 0.105 1000/5000 Catamaran::Logger#log
|
|
399
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_warn?
|
|
400
|
+
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
401
|
+
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
402
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#warn
|
|
403
|
+
--------------------------------------------------------------------------------
|
|
404
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#fatal
|
|
405
|
+
0.118 0.006 0.000 0.112 1000/2000 WithTheRubyProfiler#run
|
|
406
|
+
18.59% 0.90% 0.118 0.006 0.000 0.112 2000 *Catamaran::Logger#fatal
|
|
407
|
+
0.109 0.007 0.000 0.103 1000/5000 Catamaran::Logger#log
|
|
408
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#default_fatal?
|
|
409
|
+
0.000 0.000 0.000 0.000 1/8 Symbol#to_s
|
|
410
|
+
0.000 0.000 0.000 0.000 1/8 String#to_sym
|
|
411
|
+
0.000 0.000 0.000 0.000 1000/2000 Catamaran::Logger#fatal
|
|
412
|
+
--------------------------------------------------------------------------------
|
|
413
|
+
0.093 0.021 0.000 0.072 5000/5000 <Class::Catamaran::Outputter>#write
|
|
414
|
+
14.67% 3.28% 0.093 0.021 0.000 0.072 5000 IO#puts
|
|
415
|
+
0.072 0.072 0.000 0.000 10000/10000 IO#write
|
|
416
|
+
--------------------------------------------------------------------------------
|
|
417
|
+
0.091 0.069 0.000 0.022 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
418
|
+
14.44% 10.95% 0.091 0.069 0.000 0.022 5000 Time#strftime
|
|
411
419
|
0.015 0.015 0.000 0.000 10000/10000 Fixnum#divmod
|
|
412
|
-
0.
|
|
413
|
-
--------------------------------------------------------------------------------
|
|
414
|
-
0.085 0.020 0.000 0.066 5000/5000 <Class::Catamaran::Outputter>#write
|
|
415
|
-
11.46% 2.63% 0.085 0.020 0.000 0.066 5000 IO#puts
|
|
416
|
-
0.066 0.066 0.000 0.000 10000/10000 IO#write
|
|
420
|
+
0.007 0.007 0.000 0.000 5000/5000 Fixnum#%
|
|
417
421
|
--------------------------------------------------------------------------------
|
|
418
|
-
0.
|
|
419
|
-
|
|
422
|
+
0.072 0.072 0.000 0.000 10000/10000 IO#puts
|
|
423
|
+
11.39% 11.39% 0.072 0.072 0.000 0.000 10000 IO#write
|
|
420
424
|
--------------------------------------------------------------------------------
|
|
421
|
-
0.
|
|
422
|
-
|
|
423
|
-
0.
|
|
425
|
+
0.051 0.033 0.000 0.018 5000/5000 Catamaran::Logger#_format_msg
|
|
426
|
+
8.03% 5.25% 0.051 0.033 0.000 0.018 5000 Catamaran::Logger#path_to_s
|
|
427
|
+
0.018 0.018 0.000 0.000 5000/5000 Array#join
|
|
424
428
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Manager>#delimiter
|
|
425
429
|
--------------------------------------------------------------------------------
|
|
426
|
-
0.
|
|
427
|
-
|
|
428
|
-
0.
|
|
429
|
-
--------------------------------------------------------------------------------
|
|
430
|
-
0.029 0.029 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
431
|
-
3.92% 3.92% 0.029 0.029 0.000 0.000 5000 Kernel#sprintf
|
|
432
|
-
--------------------------------------------------------------------------------
|
|
433
|
-
0.011 0.011 0.000 0.000 9998/25999 <Class::Catamaran::Outputter>#write
|
|
434
|
-
0.017 0.017 0.000 0.000 16001/25999 Catamaran::Logger#log_level
|
|
435
|
-
3.77% 3.77% 0.028 0.028 0.000 0.000 25999 Kernel#nil?
|
|
436
|
-
--------------------------------------------------------------------------------
|
|
437
|
-
0.025 0.009 0.000 0.015 1000/1000 ProfilerTest#run
|
|
438
|
-
3.31% 1.26% 0.025 0.009 0.000 0.015 1000 Catamaran::Logger#trace?
|
|
439
|
-
0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
|
|
440
|
-
--------------------------------------------------------------------------------
|
|
441
|
-
0.021 0.006 0.000 0.015 1000/1000 ProfilerTest#run
|
|
442
|
-
2.78% 0.77% 0.021 0.006 0.000 0.015 1000 Catamaran::Logger#debug?
|
|
443
|
-
0.015 0.013 0.000 0.002 1000/8003 Catamaran::Logger#log_level
|
|
430
|
+
0.038 0.017 0.000 0.020 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
431
|
+
5.94% 2.73% 0.038 0.017 0.000 0.020 5000 <Class::Time>#now
|
|
432
|
+
0.020 0.014 0.000 0.006 5000/5000 Time#initialize
|
|
444
433
|
--------------------------------------------------------------------------------
|
|
445
|
-
0.
|
|
446
|
-
|
|
447
|
-
0.015 0.012 0.000 0.002 1000/8003 Catamaran::Logger#log_level
|
|
434
|
+
0.028 0.028 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
435
|
+
4.36% 4.36% 0.028 0.028 0.000 0.000 5000 Kernel#sprintf
|
|
448
436
|
--------------------------------------------------------------------------------
|
|
449
|
-
0.020 0.
|
|
450
|
-
|
|
451
|
-
--------------------------------------------------------------------------------
|
|
452
|
-
0.019 0.013 0.000 0.006 5000/5000 <Class::Time>#now
|
|
453
|
-
2.58% 1.80% 0.019 0.013 0.000 0.006 5000 Time#initialize
|
|
437
|
+
0.020 0.014 0.000 0.006 5000/5000 <Class::Time>#now
|
|
438
|
+
3.21% 2.24% 0.020 0.014 0.000 0.006 5000 Time#initialize
|
|
454
439
|
0.006 0.006 0.000 0.000 5000/5000 Fixnum#+
|
|
440
|
+
--------------------------------------------------------------------------------
|
|
441
|
+
0.018 0.018 0.000 0.000 5000/5000 Catamaran::Logger#path_to_s
|
|
442
|
+
2.78% 2.78% 0.018 0.018 0.000 0.000 5000 Array#join
|
|
455
443
|
--------------------------------------------------------------------------------
|
|
456
444
|
0.015 0.015 0.000 0.000 10000/10000 Time#strftime
|
|
457
|
-
2.
|
|
445
|
+
2.43% 2.43% 0.015 0.015 0.000 0.000 10000 Fixnum#divmod
|
|
458
446
|
--------------------------------------------------------------------------------
|
|
459
447
|
0.014 0.014 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
460
|
-
|
|
448
|
+
2.28% 2.28% 0.014 0.014 0.000 0.000 5000 <Class::Catamaran::LogLevel>#severity_to_s
|
|
449
|
+
--------------------------------------------------------------------------------
|
|
450
|
+
0.000 0.000 0.000 0.000 17/10015 Catamaran::Logger#log_level
|
|
451
|
+
0.011 0.011 0.000 0.000 9998/10015 <Class::Catamaran::Outputter>#write
|
|
452
|
+
1.76% 1.76% 0.011 0.011 0.000 0.000 10015 Kernel#nil?
|
|
461
453
|
--------------------------------------------------------------------------------
|
|
462
|
-
0.
|
|
463
|
-
1.
|
|
454
|
+
0.009 0.009 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
455
|
+
1.39% 1.39% 0.009 0.009 0.000 0.000 5000 Fixnum#to_s
|
|
464
456
|
--------------------------------------------------------------------------------
|
|
465
|
-
0.
|
|
466
|
-
|
|
457
|
+
0.007 0.007 0.000 0.000 5000/5000 <Class::Catamaran::Formatter>#construct_formatted_message
|
|
458
|
+
1.07% 1.07% 0.007 0.007 0.000 0.000 5000 <Module::Process>#pid
|
|
467
459
|
--------------------------------------------------------------------------------
|
|
468
|
-
0.
|
|
469
|
-
|
|
460
|
+
0.007 0.007 0.000 0.000 5000/5000 Time#strftime
|
|
461
|
+
1.06% 1.06% 0.007 0.007 0.000 0.000 5000 Fixnum#%
|
|
470
462
|
--------------------------------------------------------------------------------
|
|
471
463
|
0.006 0.006 0.000 0.000 5000/5000 Time#initialize
|
|
472
|
-
0.
|
|
464
|
+
0.96% 0.96% 0.006 0.006 0.000 0.000 5000 Fixnum#+
|
|
465
|
+
--------------------------------------------------------------------------------
|
|
466
|
+
0.000 0.000 0.000 0.000 3/11 Catamaran::Logger#log_level
|
|
467
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_notice?
|
|
468
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_info?
|
|
469
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_debug?
|
|
470
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_warn?
|
|
471
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_fatal?
|
|
472
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_error?
|
|
473
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_severe?
|
|
474
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#default_trace?
|
|
475
|
+
0.03% 0.02% 0.000 0.000 0.000 0.000 11 *Catamaran::Logger#log_level
|
|
476
|
+
0.000 0.000 0.000 0.000 17/10015 Kernel#nil?
|
|
477
|
+
0.000 0.000 0.000 0.000 4/6 NilClass#nil?
|
|
478
|
+
0.000 0.000 0.000 0.000 1/1 <Object::Object>#[]
|
|
479
|
+
0.000 0.000 0.000 0.000 3/11 Catamaran::Logger#log_level
|
|
480
|
+
--------------------------------------------------------------------------------
|
|
481
|
+
0.000 0.000 0.000 0.000 1/1 WithTheRubyProfiler#run
|
|
482
|
+
0.01% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_trace?
|
|
483
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
484
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
485
|
+
--------------------------------------------------------------------------------
|
|
486
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_debug?
|
|
487
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_error?
|
|
488
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_fatal?
|
|
489
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_severe?
|
|
490
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_warn?
|
|
491
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_notice?
|
|
492
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_info?
|
|
493
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#default_trace?
|
|
494
|
+
0.01% 0.01% 0.000 0.000 0.000 0.000 8 Module#define_method
|
|
495
|
+
0.000 0.000 0.000 0.000 8/8 BasicObject#singleton_method_added
|
|
496
|
+
--------------------------------------------------------------------------------
|
|
497
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#error
|
|
498
|
+
0.01% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_error?
|
|
499
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
500
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
501
|
+
--------------------------------------------------------------------------------
|
|
502
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#fatal
|
|
503
|
+
0.01% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_fatal?
|
|
504
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
505
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
506
|
+
--------------------------------------------------------------------------------
|
|
507
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#severe
|
|
508
|
+
0.01% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_severe?
|
|
509
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
510
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
511
|
+
--------------------------------------------------------------------------------
|
|
512
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#warn
|
|
513
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_warn?
|
|
514
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
515
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
516
|
+
--------------------------------------------------------------------------------
|
|
517
|
+
0.000 0.000 0.000 0.000 1/1 WithTheRubyProfiler#run
|
|
518
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_info?
|
|
519
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
520
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
521
|
+
--------------------------------------------------------------------------------
|
|
522
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#notice
|
|
523
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_notice?
|
|
524
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
525
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
526
|
+
--------------------------------------------------------------------------------
|
|
527
|
+
0.000 0.000 0.000 0.000 1/1 WithTheRubyProfiler#run
|
|
528
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Catamaran::Logger#default_debug?
|
|
529
|
+
0.000 0.000 0.000 0.000 1/11 Catamaran::Logger#log_level
|
|
530
|
+
0.000 0.000 0.000 0.000 1/8 Module#define_method
|
|
531
|
+
--------------------------------------------------------------------------------
|
|
532
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
533
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#notice
|
|
534
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#severe
|
|
535
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#error
|
|
536
|
+
0.000 0.000 0.000 0.000 3/8 WithTheRubyProfiler#run
|
|
537
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#warn
|
|
538
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 8 String#to_sym
|
|
539
|
+
--------------------------------------------------------------------------------
|
|
540
|
+
0.000 0.000 0.000 0.000 8/8 Module#define_method
|
|
541
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 8 BasicObject#singleton_method_added
|
|
542
|
+
--------------------------------------------------------------------------------
|
|
543
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#fatal
|
|
544
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#notice
|
|
545
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#severe
|
|
546
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#error
|
|
547
|
+
0.000 0.000 0.000 0.000 1/8 Catamaran::Logger#warn
|
|
548
|
+
0.000 0.000 0.000 0.000 3/8 WithTheRubyProfiler#run
|
|
549
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 8 Symbol#to_s
|
|
473
550
|
--------------------------------------------------------------------------------
|
|
474
551
|
0.000 0.000 0.000 0.000 2/6 <Class::Catamaran::Outputter>#write
|
|
475
552
|
0.000 0.000 0.000 0.000 4/6 Catamaran::Logger#log_level
|
|
@@ -481,12 +558,15 @@ Sort by: total_time
|
|
|
481
558
|
0.000 0.000 0.000 0.000 1/1 Global#[No method]
|
|
482
559
|
0.00% 0.00% 0.000 0.000 0.000 0.000 1 Class#new
|
|
483
560
|
0.000 0.000 0.000 0.000 1/1 BasicObject#initialize
|
|
561
|
+
--------------------------------------------------------------------------------
|
|
562
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#path_to_s
|
|
563
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#delimiter
|
|
484
564
|
--------------------------------------------------------------------------------
|
|
485
565
|
0.000 0.000 0.000 0.000 1/1 <Class::Catamaran::Outputter>#write
|
|
486
566
|
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Class::Catamaran::Manager>#stderr?
|
|
487
567
|
--------------------------------------------------------------------------------
|
|
488
|
-
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#
|
|
489
|
-
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <
|
|
568
|
+
0.000 0.000 0.000 0.000 1/1 Catamaran::Logger#log_level
|
|
569
|
+
0.00% 0.00% 0.000 0.000 0.000 0.000 1 <Object::Object>#[]
|
|
490
570
|
--------------------------------------------------------------------------------
|
|
491
571
|
0.000 0.000 0.000 0.000 1/1 Class#new
|
|
492
572
|
0.00% 0.00% 0.000 0.000 0.000 0.000 1 BasicObject#initialize
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
$: << '../lib'
|
|
2
|
+
|
|
3
|
+
# ruby simple_benchmark.rb 2>/dev/null
|
|
4
|
+
|
|
5
|
+
require 'catamaran'
|
|
6
|
+
require 'benchmark'
|
|
7
|
+
|
|
8
|
+
DEFAULT_NUM_ITERATIONS = 1000000
|
|
9
|
+
|
|
10
|
+
Catamaran.logger.log_level = :warn
|
|
11
|
+
CATAMARAN_LOGGER = Catamaran.logger
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
n = DEFAULT_NUM_ITERATIONS
|
|
15
|
+
|
|
16
|
+
STDOUT.puts ""
|
|
17
|
+
STDOUT.puts "Writing logs"
|
|
18
|
+
STDOUT.puts "============="
|
|
19
|
+
|
|
20
|
+
Benchmark.bm(7) do |x|
|
|
21
|
+
x.report("STDERR.puts") {
|
|
22
|
+
n.times do |i|
|
|
23
|
+
STDERR.puts "This is your last warning"
|
|
24
|
+
end
|
|
25
|
+
}
|
|
26
|
+
x.report("warn ") {
|
|
27
|
+
n.times do |i|
|
|
28
|
+
CATAMARAN_LOGGER.warn "This is your last warning"
|
|
29
|
+
end
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
STDOUT.puts ""
|
|
34
|
+
STDOUT.puts "Conditional disabled"
|
|
35
|
+
STDOUT.puts "===================="
|
|
36
|
+
|
|
37
|
+
n = DEFAULT_NUM_ITERATIONS
|
|
38
|
+
Benchmark.bm(7) do |x|
|
|
39
|
+
x.report("STDERR.puts") {
|
|
40
|
+
n.times do |i|
|
|
41
|
+
STDERR.puts "This debug message will not be output by the logger" if false
|
|
42
|
+
end
|
|
43
|
+
}
|
|
44
|
+
x.report("debug ") {
|
|
45
|
+
n.times do |i|
|
|
46
|
+
CATAMARAN_LOGGER.debug "This debug message will not be output by the logger" if CATAMARAN_LOGGER.debug?
|
|
47
|
+
end
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Writing logs
|
|
52
|
+
# =============
|
|
53
|
+
# user system total real
|
|
54
|
+
# STDERR.puts 2.060000 1.460000 3.520000 ( 3.529794)
|
|
55
|
+
# warn 12.950000 2.010000 14.960000 ( 14.971881)
|
|
56
|
+
|
|
57
|
+
# Conditional disabled
|
|
58
|
+
# ====================
|
|
59
|
+
# user system total real
|
|
60
|
+
# STDERR.puts 0.060000 0.000000 0.060000 ( 0.052432)
|
|
61
|
+
# debug 0.150000 0.000000 0.150000 ( 0.150887)
|
|
62
|
+
|