civo-logger 0.2.0 → 0.2.1

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: 0d806872c75463ff5d7b2aaa9a2b47b76360fe47
4
- data.tar.gz: ec89b7afc7abf0b47c3862c54f1ee0961e15b444
3
+ metadata.gz: 8d6b9a95a776580137a4982bdca4294a0abf6bf0
4
+ data.tar.gz: 77216d7a025059bf1a7c715b21c5afc925e06fab
5
5
  SHA512:
6
- metadata.gz: 8f34289f1b43d794698e322508400583e14ebdc71f0cf54f0b540144953c93f919a44a4d7087594469a9d4ee78e49d835f04c984e9e0b0e0be4491e53865a023
7
- data.tar.gz: ec245006aa55eb01897e67e93e2090d521647255f2e5a155b5673adfaf9dc7fb1a6ee8abf63a7f9fd0b9980d8c545912811034006d1a5297824daac514a90098
6
+ metadata.gz: 337eb390831966284b2e6caebfa77787cbc5da6d024a96358dc7dd4b3fcb980e5b53bf1ce32247c3eb7474db4e7d4bf0e7794e4e65747a29234bdce2712af341
7
+ data.tar.gz: 54a381dfb8c7e53633b52c5eeb7f6c6fe81a47a0a9c5874c21a698614481657131b13d25ef38f0c2dd9f8d3b6e9096e5af7ef1a1b3d66c1d16088561d79711c2
@@ -6,6 +6,7 @@ require "rack/body_proxy"
6
6
 
7
7
  module Civo
8
8
  class PerRequestLogger < ActiveSupport::LogSubscriber
9
+ cattr_accessor :redis
9
10
  STATS_RESOLUTION = 5.minutes
10
11
 
11
12
  def initialize(app, taggers = nil)
@@ -13,14 +14,14 @@ module Civo
13
14
  @taggers = taggers || []
14
15
  Rails.logger = ActionController::Base.logger = ActiveRecord::Base.logger = self
15
16
  $stdout.sync = true
16
- if ENV["RAILS_LOGGER_HOSTNAME"].present?
17
+ if ENV["RAILS_LOGGER_HOSTNAME"].blank? || Rails.env.test?
18
+ @redis = self.class.redis || Redis.current
19
+ else
17
20
  options = {host: ENV["RAILS_LOGGER_HOSTNAME"], port: Rails.application.config.x.redis_port, timeout: 1}
18
21
  if ENV["RAILS_LOGGER_PASSWORD"].present?
19
22
  options[:password] = ENV["RAILS_LOGGER_PASSWORD"]
20
23
  end
21
24
  @redis = Redis.new(options)
22
- else
23
- @redis = Redis.current
24
25
  end
25
26
  end
26
27
 
@@ -1,5 +1,5 @@
1
1
  module Civo
2
2
  module Logger
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: civo-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-08 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler