redis_failover-rails 0.1.1 → 0.2.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: 815798df4dad8e2808c91aa05a7eb4113bbe43d3
4
- data.tar.gz: a369751f3867d1cd900d9fbd23a5448f965e7c39
3
+ metadata.gz: 7816addee8e1421a15b6a0d8176030f92c718810
4
+ data.tar.gz: f0ef36940f3867369442dd776bbe824db1a78aa0
5
5
  SHA512:
6
- metadata.gz: 819937fdc09c7dedab7f77c5504c701941aaaa709b99ee0198c43cbc16ffcd9657e06c8138886508eeb2cf41eadb5b88e4a4bf92b387e614742ce9eb1df20e7c
7
- data.tar.gz: 70c10548893ab1e8caae9ae0a34465b0180e25f6f796b656ecee8f7ad81d336bc97b78c5254716d3a104e559e3664b4f546c2a6b5770a18c6693d04b3419edb9
6
+ metadata.gz: c1fc99fccc93225cf92ac299993807ecb5096d7e668c04610cd027f009b79f958321ed4994a9bd7e5eccb5f900d456d2b0aa7de4f223f36b833fdb2cda126720
7
+ data.tar.gz: c38d3983ac9e2533c99a11ed14db6a73e814c56dbdbfdf74fd5bb5c2ce1beaf17b9187c6cfc272cea51d026c7d8781ac61a77fb69f830f13e77bf36a624e3941
data/.gitignore CHANGED
@@ -43,3 +43,4 @@ test/dummy/.sass-cache
43
43
 
44
44
  dump.rdb
45
45
  redis.log
46
+ redlog.log
data/README.md CHANGED
@@ -125,6 +125,12 @@ Basic `redis.yml` examples:
125
125
  db: 1
126
126
  znode_path: /redis_failover #sometimes required...
127
127
 
128
+ ## Improved logging
129
+ Since version 0.2.0 we added an option to use a separate logfile for the logs coming from Redis_Failover. Using the `logfile:` option in the configuration file, the gem just creates a new logfile.
130
+
131
+ Just add in redis.yml
132
+ logfile: redlog.log
133
+
128
134
  ## License
129
135
  This gem is released with MIT licensing. Please see [LICENSE](https://github.com/surfdome/redis_failover-rails/blob/master/LICENSE) for details.
130
136
 
data/config/redis.yml CHANGED
@@ -6,6 +6,7 @@ development:
6
6
  zkservers: localhost:2181, localhost:2182, localhost:2183
7
7
  znode_path: /redis_failover/nodes
8
8
  db: 1
9
+ logfile: redlog.log
9
10
 
10
11
  production:
11
12
  cache:
@@ -13,21 +14,25 @@ production:
13
14
  zkservers: localhost:2181, localhost:2182, localhost:2183
14
15
  znode_path: /redis_failover
15
16
  db: 0
17
+ logfile: redlog.log
16
18
 
17
19
  test:
18
20
  hacache:
19
21
  zkservers: localhost:2181
20
22
  db: 8
21
23
  thread_safe: true
24
+ logfile: redlog.log
22
25
  myredisdb:
23
26
  db: 1
24
27
  host: localhost
25
28
  port: 6379
26
29
  thread_safe: true
30
+ logfile: redlog.log
27
31
  cache:
28
32
  db: 2
29
33
  host: localhost
30
34
  port: 6379
31
35
  thread_safe: true
36
+ logfile: redlog.log
32
37
 
33
38
 
data/lib/redis_factory.rb CHANGED
@@ -24,17 +24,14 @@ class RedisFactory
24
24
  conf = configuration[name].symbolize_keys!
25
25
  raise "No redis configuration for #{Rails.env} environment in redis.yml for #{name}" unless conf
26
26
  synchronize do
27
- # if conf[:zkservers]
28
- # conf[:logger] = logger
29
- # @@clients[name] ||= ::RedisFailover::Client.new(
30
- # :zkservers => 'localhost:2181,localhost:2182,localhost:2183',
31
- # :znode_path => '/redis_failover',
32
- # :db => '1')
33
- # else
34
- # @@clients[name] ||= ::Redis.new()
35
- # end
36
27
  if conf[:zkservers]
37
- conf[:logger] = logger
28
+ if conf[:logfile]
29
+ filelogger = Logger.new(conf[:logfile])
30
+ conf[:logger] = filelogger
31
+ else
32
+ conf[:logger] = logger
33
+ end
34
+
38
35
  @@clients[name] ||= ::RedisFailover::Client.new(conf)
39
36
  else
40
37
  @@clients[name] ||= ::Redis.new(conf)
@@ -1,3 +1,3 @@
1
1
  module RedisFailoverRails
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -21,16 +21,19 @@ class RedisFactoryTest < ActiveSupport::TestCase
21
21
  "db" => 1,
22
22
  "host" => "localhost",
23
23
  "port" => 6379,
24
- "thread_safe" => true },
24
+ "thread_safe" => true,
25
+ "logfile" => "redlog.log"},
25
26
  :cache => {
26
27
  "db" => 2,
27
28
  "host" => "localhost",
28
29
  "port" => 6379,
29
- "thread_safe" => true },
30
+ "thread_safe" => true,
31
+ "logfile" => "redlog.log" },
30
32
  :hacache => {
31
33
  "db" => 8,
32
34
  "thread_safe" => true,
33
- "zkservers" => "localhost:2181" }
35
+ "zkservers" => "localhost:2181",
36
+ "logfile" => "redlog.log" }
34
37
  },
35
38
  RedisFactory.configuration)
36
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_failover-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Pettoruti - Surfdome.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis_failover