rubytune / perf_check

PERRRFFF CHERRRRK!
17 stars 7 forks source link

remove Object logger #15

Closed edanc closed 8 years ago

edanc commented 8 years ago

having

class Object        
 def self.logger; PerfCheck.logger; end     
 def logger; PerfCheck.logger; end      
end

was not allowing us to write to log/development.log. For example in the debugger when calling logger it was using PerfCheck::Logger

[1] pry(#<HomeController>)> logger
=> #<Logger:0x007ff89ff392c0
 @default_formatter=#<Logger::Formatter:0x007ff89ff39298 @datetime_format=nil>,
 @formatter=#<Proc:0x007ff89ff39158@/usr/local/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/perf_check-0.4.0/lib/perf_check/logger.rb:7>,
 @level=0,
 @logdev=
  #<Logger::LogDevice:0x007ff89ff39248
   @dev=#<IO:<STDERR>>,
   @filename=nil,
   @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007ff89ff39220 @mon_count=0, @mon_mutex=#<Mutex:0x007ff89ff391d0>, @mon_owner=nil>,
   @shift_age=nil,
   @shift_size=nil>,
 @progname=nil>

after removing it we got

[1] pry(#<HomeController>)> logger
=> #<ActiveSupport::Logger:0x007feca7649150
 @default_formatter=#<Logger::Formatter:0x007feca76490d8 @datetime_format=nil>,
 @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x007fec92a92aa0 @datetime_format=nil>,
 @level=0,
 @logdev=
  #<Logger::LogDevice:0x007feca7649088
   @dev=#<File:/Users/USER/app/log/development.log>,
   @filename=nil,
   @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007feca7649060 @mon_count=0, @mon_mutex=#<Mutex:0x007feca7649010>, @mon_owner=nil>,
   @shift_age=nil,
   @shift_size=nil>,
 @progname=nil>
edanc commented 8 years ago
➜  test_app git:(edc_logger) be perf_check /posts -n 3
[2016-03-15 11:41:19 -0700]  INFO --: starting rails...
/usr/local/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now
[2016-03-15 11:41:22 -0700]  INFO --: =============================================================================
[2016-03-15 11:41:22 -0700]  INFO --: PERRRRF CHERRRK! Grab a ☕️  and don't touch your working tree (we automate git)
[2016-03-15 11:41:22 -0700]  INFO --: =============================================================================
[2016-03-15 11:41:22 -0700]  INFO --:
[2016-03-15 11:41:22 -0700]  INFO --: Benchmarking /posts:
[2016-03-15 11:41:22 -0700]  INFO --:   request   latency   server rss   status   queries   profiler data
[2016-03-15 11:41:23 -0700]  INFO --:    1:   595.1ms     63MB    200      5500    /mini-profiler-resources/results?id=lu5vnpv7a1in2c733m
[2016-03-15 11:41:24 -0700]  INFO --:    2:   593.8ms     64MB    200      5500    /mini-profiler-resources/results?id=6mkm7dgjprzoxdz3bjwl
[2016-03-15 11:41:25 -0700]  INFO --:    3:   593.5ms     64MB    200      5500    /mini-profiler-resources/results?id=f36o7e68pvtjojyv2e2s
[2016-03-15 11:41:25 -0700]  INFO --:
[2016-03-15 11:41:25 -0700]  INFO --: Checking out master and bundling...
[2016-03-15 11:41:25 -0700]  INFO --: re-starting rails...
/usr/local/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now
[2016-03-15 11:41:30 -0700]  INFO --: =============================================================================
[2016-03-15 11:41:30 -0700]  INFO --: PERRRRF CHERRRK! Grab a ☕️  and don't touch your working tree (we automate git)
[2016-03-15 11:41:30 -0700]  INFO --: =============================================================================
[2016-03-15 11:41:30 -0700]  INFO --:
[2016-03-15 11:41:30 -0700]  INFO --: Benchmarking /posts:
[2016-03-15 11:41:30 -0700]  INFO --:   request   latency   server rss   status   queries   profiler data
[2016-03-15 11:41:31 -0700]  INFO --:    1:   603.2ms     64MB    200      5500    /mini-profiler-resources/results?id=s4opd3k43ly964gyule5
[2016-03-15 11:41:32 -0700]  INFO --:    2:   598.6ms     65MB    200      5500    /mini-profiler-resources/results?id=84qiq8h63yywicpep8pi
[2016-03-15 11:41:32 -0700]  INFO --:    3:   597.4ms     65MB    200      5500    /mini-profiler-resources/results?id=wxdjd3gc5xr02ex60ksr
[2016-03-15 11:41:32 -0700]  INFO --:
==== Results ====
/posts
    reference: 599.7ms
  your branch: 594.1ms
       change: -5.6ms (yours is about the same)
[2016-03-15 11:41:32 -0700]  INFO --:
[2016-03-15 11:41:32 -0700]  INFO --: Checking out edc_logger and bundling...```