td-logger 0.3.19 → 0.3.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +7 -0
- data/Gemfile +1 -1
- data/README.rdoc +15 -0
- data/VERSION +1 -1
- data/lib/td/logger.rb +16 -0
- data/lib/td/logger/agent/rails.rb +3 -1
- data/lib/td/logger/agent/rails/config.rb +6 -1
- data/lib/td/logger/version.rb +1 -1
- data/spec/rails_config_spec.rb +15 -0
- metadata +11 -29
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 110f0ec970ce555e007a94e81e718291e82976f1
|
4
|
+
data.tar.gz: 5c40fe56ae2bd3d7ed114ff4791d979670caa347
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 844b62d3907c567c5c3520927ac0aea3ce3eaf178bfe0e1636c7de8eab7cec518440d4f0bed80fbd52467988b081428a632706773010c168fa2e4c59534d8a41
|
7
|
+
data.tar.gz: 395a528bdac8e5433ae31c89e97cbfcdca8a8fd964eed6606d217deaa973714a0678e338f0b2e4007deddc5232afaa3a68bf3b95a0ab60996f75cdf7f1bea99b
|
data/ChangeLog
CHANGED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -88,6 +88,21 @@ NOTE: This configuration is not supported on PaaP platforms.
|
|
88
88
|
tag: td.myapp
|
89
89
|
debug_mode: false
|
90
90
|
|
91
|
+
=== Test mode
|
92
|
+
|
93
|
+
This mode uses TestLogger of fluent-logger-ruby to store the events.
|
94
|
+
If you want to enable this mode, then specify 'test_mode' in your configuration.
|
95
|
+
|
96
|
+
development:
|
97
|
+
apikey: "YOUR_API_KEY"
|
98
|
+
database: rails_development
|
99
|
+
debug_mode: true
|
100
|
+
test_mode: true
|
101
|
+
|
102
|
+
You can access the logger instance via TD.logger to check the status.
|
103
|
+
|
104
|
+
TD.logger.queue #=> [{},{},..]
|
105
|
+
|
91
106
|
== Further Readings
|
92
107
|
|
93
108
|
If you have any problem, please ask us from the support site.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.20
|
data/lib/td/logger.rb
CHANGED
@@ -6,6 +6,10 @@ module Logger
|
|
6
6
|
|
7
7
|
@@logger = nil
|
8
8
|
|
9
|
+
def self.logger
|
10
|
+
@@logger
|
11
|
+
end
|
12
|
+
|
9
13
|
def self.open(database, options={})
|
10
14
|
@@logger = TreasureData::Logger::TreasureDataLogger.new(database, options)
|
11
15
|
end
|
@@ -18,6 +22,10 @@ module Logger
|
|
18
22
|
@@logger = Fluent::Logger::NullLogger.new
|
19
23
|
end
|
20
24
|
|
25
|
+
def self.open_test
|
26
|
+
@@logger = Fluent::Logger::TestLogger.new
|
27
|
+
end
|
28
|
+
|
21
29
|
def self.post(tag, record={})
|
22
30
|
@@logger.post(tag, record)
|
23
31
|
end
|
@@ -33,6 +41,10 @@ end
|
|
33
41
|
module TreasureData
|
34
42
|
require 'td/logger/event'
|
35
43
|
|
44
|
+
def self.logger
|
45
|
+
TreasureData::Logger.logger
|
46
|
+
end
|
47
|
+
|
36
48
|
def self.open(database, options={})
|
37
49
|
TreasureData::Logger.open(database, options)
|
38
50
|
end
|
@@ -45,6 +57,10 @@ module TreasureData
|
|
45
57
|
TreasureData::Logger.open_null
|
46
58
|
end
|
47
59
|
|
60
|
+
def self.open_test
|
61
|
+
TreasureData::Logger.open_test
|
62
|
+
end
|
63
|
+
|
48
64
|
def self.post(tag, record={})
|
49
65
|
TreasureData::Logger.post(tag, record)
|
50
66
|
end
|
@@ -19,7 +19,9 @@ module Agent::Rails
|
|
19
19
|
return false
|
20
20
|
end
|
21
21
|
|
22
|
-
if c.
|
22
|
+
if c.test_mode?
|
23
|
+
::TreasureData::Logger.open_test
|
24
|
+
elsif c.agent_mode?
|
23
25
|
::TreasureData::Logger.open_agent(c.tag, :host=>c.agent_host, :port=>c.agent_port, :debug=>c.debug_mode)
|
24
26
|
else
|
25
27
|
::TreasureData::Logger.open(c.database, :apikey=>c.apikey, :auto_create_table=>c.auto_create_table, :debug=>c.debug_mode)
|
@@ -30,12 +30,13 @@ module Agent::Rails
|
|
30
30
|
@debug_mode = !!conf['debug_mode']
|
31
31
|
end
|
32
32
|
|
33
|
+
@test_mode = !!conf['test_mode']
|
33
34
|
@access_log_table = conf['access_log_table']
|
34
35
|
end
|
35
36
|
|
36
37
|
attr_reader :agent_host, :agent_port, :tag
|
37
38
|
attr_reader :apikey, :database, :auto_create_table
|
38
|
-
attr_reader :access_log_table, :debug_mode
|
39
|
+
attr_reader :access_log_table, :debug_mode, :test_mode
|
39
40
|
attr_accessor :disabled
|
40
41
|
|
41
42
|
def initialize
|
@@ -46,6 +47,10 @@ module Agent::Rails
|
|
46
47
|
@agent_host != nil
|
47
48
|
end
|
48
49
|
|
50
|
+
def test_mode?
|
51
|
+
@test_mode
|
52
|
+
end
|
53
|
+
|
49
54
|
def access_log_enabled?
|
50
55
|
!@access_log_table.nil? && !@access_log_table.empty?
|
51
56
|
end
|
data/lib/td/logger/version.rb
CHANGED
data/spec/rails_config_spec.rb
CHANGED
@@ -134,6 +134,21 @@ EOF
|
|
134
134
|
c.agent_host.should == 'localhost'
|
135
135
|
c.agent_port.should == 24224
|
136
136
|
end
|
137
|
+
|
138
|
+
it 'test mode' do
|
139
|
+
FileUtils.mkdir_p("#{TMP_DIR}/config")
|
140
|
+
File.open("#{TMP_DIR}/config/treasure_data.yml", "w") {|f|
|
141
|
+
f.write <<EOF
|
142
|
+
test:
|
143
|
+
agent: localhost
|
144
|
+
tag: td.db5
|
145
|
+
test_mode: true
|
146
|
+
EOF
|
147
|
+
}
|
148
|
+
c = TreasureData::Logger::Agent::Rails::Config.init
|
149
|
+
c.disabled.should == false
|
150
|
+
c.test_mode?.should == true
|
151
|
+
end
|
137
152
|
end
|
138
153
|
end
|
139
154
|
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.20
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sadayuki Furuhashi
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
11
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: msgpack
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: td-client
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: fluent-logger
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,33 +55,29 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 0.9.2
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 0.9.2
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: 2.7.0
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 2.7.0
|
94
83
|
description: Treasure Data logging library for Rails
|
@@ -121,33 +110,26 @@ files:
|
|
121
110
|
- td-logger.gemspec
|
122
111
|
homepage:
|
123
112
|
licenses: []
|
113
|
+
metadata: {}
|
124
114
|
post_install_message:
|
125
115
|
rdoc_options: []
|
126
116
|
require_paths:
|
127
117
|
- lib
|
128
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
119
|
requirements:
|
131
|
-
- -
|
120
|
+
- - '>='
|
132
121
|
- !ruby/object:Gem::Version
|
133
122
|
version: '0'
|
134
|
-
segments:
|
135
|
-
- 0
|
136
|
-
hash: -1316204649964571455
|
137
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
124
|
requirements:
|
140
|
-
- -
|
125
|
+
- - '>='
|
141
126
|
- !ruby/object:Gem::Version
|
142
127
|
version: '0'
|
143
|
-
segments:
|
144
|
-
- 0
|
145
|
-
hash: -1316204649964571455
|
146
128
|
requirements: []
|
147
129
|
rubyforge_project:
|
148
|
-
rubygems_version:
|
130
|
+
rubygems_version: 2.0.0
|
149
131
|
signing_key:
|
150
|
-
specification_version:
|
132
|
+
specification_version: 4
|
151
133
|
summary: Treasure Data logging library for Rails
|
152
134
|
test_files:
|
153
135
|
- spec/event_spec.rb
|