influxdb 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/influxdb/client.rb +1 -1
- data/lib/influxdb/logger.rb +12 -2
- data/lib/influxdb/version.rb +1 -1
- data/lib/influxdb/worker.rb +1 -1
- data/spec/influxdb/logger_spec.rb +19 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89e34f73dc79fdd7911d7b95222437c9a36b3839
|
4
|
+
data.tar.gz: 2e62a50a70a4b7848a66a84d1033d49194d09445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04a951e2106d61547d4409ebac4dcb2055c5d38012fc9b40cb97d46af7dfa9426fc27f7a27b7657e9587faf7d15d322d2e80a4b7f8da6967e2fc06edcff1458b
|
7
|
+
data.tar.gz: 51ec22a345e521fc8adcfd7ec71a2bc488098d389b9b9463a51acd2ea262c86297d4d015fd5ceb8fb026eba9a9ecf6f82ed985f3dce62ee8641da7668f298e48
|
data/lib/influxdb/client.rb
CHANGED
data/lib/influxdb/logger.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
1
3
|
module InfluxDB
|
2
|
-
module
|
4
|
+
module Logging
|
3
5
|
PREFIX = "[InfluxDB] "
|
4
6
|
|
7
|
+
def self.logger=(new_logger)
|
8
|
+
@logger = new_logger
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.logger
|
12
|
+
@logger ||= ::Logger.new(STDERR).tap {|logger| logger.level = Logger::INFO}
|
13
|
+
end
|
14
|
+
|
5
15
|
private
|
6
16
|
def log(level, message)
|
7
|
-
|
17
|
+
InfluxDB::Logging.logger.send(level.to_sym, PREFIX + message)
|
8
18
|
end
|
9
19
|
end
|
10
20
|
end
|
data/lib/influxdb/version.rb
CHANGED
data/lib/influxdb/worker.rb
CHANGED
@@ -1,29 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'logger'
|
2
3
|
|
3
|
-
describe InfluxDB::
|
4
|
+
describe InfluxDB::Logging do
|
4
5
|
class LoggerTest
|
5
|
-
include InfluxDB::
|
6
|
+
include InfluxDB::Logging
|
6
7
|
|
7
8
|
def write_to_log(level, message)
|
8
9
|
log(level, message)
|
9
10
|
end
|
11
|
+
|
10
12
|
end
|
11
13
|
|
12
|
-
|
14
|
+
before { @old_logger = InfluxDB::Logging.logger }
|
15
|
+
after { InfluxDB::Logging.logger = @old_logger }
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
it "has a default logger" do
|
18
|
+
expect(InfluxDB::Logging.logger).to be_a(Logger)
|
19
|
+
end
|
17
20
|
|
18
|
-
|
19
|
-
|
21
|
+
it "allows setting of a logger" do
|
22
|
+
new_logger = Logger.new(STDOUT)
|
23
|
+
InfluxDB::Logging.logger = new_logger
|
24
|
+
expect(InfluxDB::Logging.logger).to eq(new_logger)
|
20
25
|
end
|
21
26
|
|
22
|
-
context
|
23
|
-
|
24
|
-
|
27
|
+
context "when included in classes" do
|
28
|
+
|
29
|
+
subject { LoggerTest.new }
|
25
30
|
|
26
|
-
|
31
|
+
it "logs" do
|
32
|
+
expect(InfluxDB::Logging.logger).to receive(:debug).with(an_instance_of(String)).once
|
33
|
+
subject.write_to_log(:debug, 'test')
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|