td-logger 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/ChangeLog +7 -0
- data/Gemfile +3 -0
- data/Rakefile +13 -0
- data/VERSION +1 -0
- data/lib/td/logger.rb +2 -2
- data/lib/td/logger/agent/rails/config.rb +1 -1
- data/lib/td/logger/version.rb +1 -1
- data/spec/event_spec.rb +3 -1
- data/spec/td_logger_spec.rb +9 -8
- data/td-logger.gemspec +38 -0
- metadata +44 -13
data/.gitignore
ADDED
data/ChangeLog
CHANGED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3.7
|
data/lib/td/logger.rb
CHANGED
@@ -22,7 +22,7 @@ module Logger
|
|
22
22
|
@@logger.post(tag, record)
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.post_with_time(tag, record
|
25
|
+
def self.post_with_time(tag, record, time)
|
26
26
|
@@logger.post_with_time(tag, record, time)
|
27
27
|
end
|
28
28
|
end
|
@@ -49,7 +49,7 @@ module TreasureData
|
|
49
49
|
TreasureData::Logger.post(tag, record)
|
50
50
|
end
|
51
51
|
|
52
|
-
def self.post_with_time(tag, record
|
52
|
+
def self.post_with_time(tag, record, time)
|
53
53
|
TreasureData::Logger.post_with_time(tag, record, time)
|
54
54
|
end
|
55
55
|
|
@@ -68,7 +68,7 @@ module Agent::Rails
|
|
68
68
|
return nil
|
69
69
|
end
|
70
70
|
|
71
|
-
conf = env_conf[::Rails.env] if
|
71
|
+
conf = env_conf[::Rails.env] if env_conf.is_a?(Hash)
|
72
72
|
unless conf
|
73
73
|
logger.warn "WARNING: #{CONFIG_PATH} doesn't include setting for current environment (#{::Rails.env})."
|
74
74
|
logger.warn "WARNING: Disabling Treasure Data event logger."
|
data/lib/td/logger/version.rb
CHANGED
data/spec/event_spec.rb
CHANGED
@@ -8,7 +8,9 @@ describe TreasureData::Logger::Event do
|
|
8
8
|
end
|
9
9
|
before(:each) do
|
10
10
|
t = test_logger
|
11
|
-
TreasureData::Logger.
|
11
|
+
TreasureData::Logger.module_eval do
|
12
|
+
class_variable_set(:@@logger, t)
|
13
|
+
end
|
12
14
|
TD.event.attribute.clear
|
13
15
|
end
|
14
16
|
|
data/spec/td_logger_spec.rb
CHANGED
@@ -4,28 +4,29 @@ require 'spec_helper'
|
|
4
4
|
describe TreasureData::Logger::TreasureDataLogger do
|
5
5
|
context 'init' do
|
6
6
|
it 'db config' do
|
7
|
-
td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'
|
7
|
+
td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'test_1')
|
8
8
|
time = Time.now
|
9
9
|
td.should_receive(:add).with('db1', 'table1', {:foo=>:bar, :time=>time.to_i})
|
10
10
|
td.post_with_time('table1', {:foo=>:bar}, time)
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'fluent-logger-td compat' do
|
14
|
-
td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'
|
14
|
+
td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'test_2')
|
15
15
|
time = Time.now
|
16
16
|
td.should_receive(:add).with('overwrite', 'table1', {:foo=>:bar, :time=>time.to_i})
|
17
17
|
td.post_with_time('overwrite.table1', {:foo=>:bar}, time)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
## TODO this causes real upload
|
21
|
+
#it 'success' do
|
22
|
+
# td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'test_3')
|
23
|
+
# td.post('valid', {}).should == true
|
24
|
+
#end
|
24
25
|
end
|
25
26
|
|
26
27
|
context 'validate' do
|
27
28
|
it 'validate table name' do
|
28
|
-
td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'
|
29
|
+
td = TreasureData::Logger::TreasureDataLogger.new('db1', :apikey=>'test_4')
|
29
30
|
proc {
|
30
31
|
td.post('invalid-name', {})
|
31
32
|
}.should raise_error(RuntimeError)
|
@@ -38,7 +39,7 @@ describe TreasureData::Logger::TreasureDataLogger do
|
|
38
39
|
end
|
39
40
|
|
40
41
|
it 'validate database name' do
|
41
|
-
td = TreasureData::Logger::TreasureDataLogger.new('invalid-db-name', :apikey=>'
|
42
|
+
td = TreasureData::Logger::TreasureDataLogger.new('invalid-db-name', :apikey=>'test_5')
|
42
43
|
proc {
|
43
44
|
td.post('table', {})
|
44
45
|
}.should raise_error(RuntimeError)
|
data/td-logger.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
version_file = "lib/td/logger/version.rb"
|
6
|
+
version = File.read("VERSION").strip
|
7
|
+
File.open(version_file, "w") {|f|
|
8
|
+
f.write <<EOF
|
9
|
+
module TreasureData
|
10
|
+
module Logger
|
11
|
+
|
12
|
+
VERSION = '#{version}'
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
EOF
|
17
|
+
}
|
18
|
+
|
19
|
+
gem.name = %q{td-logger}
|
20
|
+
gem.version = version
|
21
|
+
# gem.platform = Gem::Platform::RUBY
|
22
|
+
gem.authors = ["Sadayuki Furuhashi"]
|
23
|
+
#gem.email = %q{frsyuki@gmail.com}
|
24
|
+
#gem.homepage = %q{https://github.com/treasure-data/td-logger-ruby}
|
25
|
+
gem.description = %q{Treasure Data logging library for Rails}
|
26
|
+
gem.summary = gem.description
|
27
|
+
|
28
|
+
gem.files = `git ls-files`.split("\n")
|
29
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
31
|
+
gem.require_paths = ['lib']
|
32
|
+
|
33
|
+
gem.add_dependency "msgpack", "~> 0.4.4"
|
34
|
+
gem.add_dependency "td-client", "~> 0.8.4"
|
35
|
+
gem.add_dependency "fluent-logger", "~> 0.4.1"
|
36
|
+
gem.add_development_dependency 'rake', '>= 0.9.2'
|
37
|
+
gem.add_development_dependency 'rspec', '>= 2.7.0'
|
38
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-10 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70274289643260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: 0.4.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70274289643260
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: td-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70274289642660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.8.
|
32
|
+
version: 0.8.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70274289642660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: fluent-logger
|
38
|
-
requirement: &
|
38
|
+
requirement: &70274289642080 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,15 +43,41 @@ dependencies:
|
|
43
43
|
version: 0.4.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
|
46
|
+
version_requirements: *70274289642080
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &70274289641520 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.2
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70274289641520
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: &70274289640940 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.7.0
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70274289640940
|
69
|
+
description: Treasure Data logging library for Rails
|
48
70
|
email:
|
49
71
|
executables: []
|
50
72
|
extensions: []
|
51
|
-
extra_rdoc_files:
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- .gitignore
|
52
76
|
- ChangeLog
|
77
|
+
- Gemfile
|
53
78
|
- README.rdoc
|
54
|
-
|
79
|
+
- Rakefile
|
80
|
+
- VERSION
|
55
81
|
- lib/td-logger.rb
|
56
82
|
- lib/td/logger.rb
|
57
83
|
- lib/td/logger/agent/rack.rb
|
@@ -66,8 +92,7 @@ files:
|
|
66
92
|
- spec/rails_config_spec.rb
|
67
93
|
- spec/spec_helper.rb
|
68
94
|
- spec/td_logger_spec.rb
|
69
|
-
-
|
70
|
-
- README.rdoc
|
95
|
+
- td-logger.gemspec
|
71
96
|
homepage:
|
72
97
|
licenses: []
|
73
98
|
post_install_message:
|
@@ -80,12 +105,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
105
|
- - ! '>='
|
81
106
|
- !ruby/object:Gem::Version
|
82
107
|
version: '0'
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
hash: -1557178488144164455
|
83
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
112
|
none: false
|
85
113
|
requirements:
|
86
114
|
- - ! '>='
|
87
115
|
- !ruby/object:Gem::Version
|
88
116
|
version: '0'
|
117
|
+
segments:
|
118
|
+
- 0
|
119
|
+
hash: -1557178488144164455
|
89
120
|
requirements: []
|
90
121
|
rubyforge_project:
|
91
122
|
rubygems_version: 1.8.10
|