Home > Database > Mysql Tutorial > [ Ruby on Rails ] RedisLogger – a better redis log

[ Ruby on Rails ] RedisLogger – a better redis log

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:29:18
Original
1284 people have browsed it

RedisLogger是一個Rails application專用的Redis logger,主要是利用Rails的ActiveSupport::LogSubscriber和ActiveSupport::Notifications去實做。 redis-rb其實有內建logger,Rails也可以輕易的使用,但在使用上,僅有每道指令的執行時間,略顯單薄,要判斷

RedisLogger是一個Rails application專用的Redis logger,主要是利用Rails的ActiveSupport::LogSubscriber和ActiveSupport::Notifications去實做。 redis-rb其實有內建logger,Rails也可以輕易的使用,但在使用上,僅有每道指令的執行時間,略顯單薄,要判斷每個action的redis執行時間還必須自己手動計算,感覺實在不太方便。所以就參考了Instrument Anything in Rails 3使用ActiveSupport::LogSubscriber和ActiveSupport::Notifications去觸發及計算執行時間,產生一個redis_logger.rb去overwrite redis-rb原本logger的行為,不但把每道Redis指令上色,並在action執行完成後計算Redis執行時間的總合。(如上圖所示) github: https://github.com/hellolucky/redis_logger enjoy it!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Error when executing ruby ​​script
From 1970-01-01 08:00:00
0
0
0
Ruby - Convert nested objects to json?
From 1970-01-01 08:00:00
0
0
0
ruby - how to update submodels in rails
From 1970-01-01 08:00:00
0
0
0
How do you configure VIM on Mac?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template