act-fluent-logger-rails 0.1.8 → 0.1.9
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 +4 -4
- data/CHANGELOG.md +6 -2
- data/README.md +16 -3
- data/lib/act-fluent-logger-rails/logger.rb +14 -12
- data/lib/act-fluent-logger-rails/version.rb +1 -1
- 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: 550119ac05199783efccabc275c43ce73de465b3
|
4
|
+
data.tar.gz: 67e8d75dda8d2d08a5fd42f725e0c6a09bc34f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a24306a282669279ce745f47c717e81e05011caa2ff0285eb62d92e8a23fd48fcddd9829a49b4dd19e96a4f0bc969fd655b524161f89aa4f7da392c692cb2d3
|
7
|
+
data.tar.gz: 699d6cf7a3974d26a3c492a5885049bd322bb7c4e07f25839aa81a3434c16a907d9767e5eba9215a5d3d524e7c4d3d4f015834c8574bb728e8f98271adca0c6e
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
## 0.1.9 / Dec 16 2015
|
2
|
+
|
3
|
+
* Added settings: parameter to ActFluentLoggerRails::Logger.new.
|
4
|
+
|
1
5
|
## 0.1.8 / Nov 14 2015
|
2
6
|
|
3
|
-
* Output Object#inspect if message is not String and not Exception.
|
7
|
+
* Output Object#inspect if message is not String and not Exception.
|
4
8
|
|
5
9
|
## 0.1.7 / July 30 2015
|
6
10
|
|
7
|
-
* Be able to log exceptions #15.
|
11
|
+
* Be able to log exceptions #15.
|
8
12
|
|
9
13
|
## 0.1.6 / March 20 2015
|
10
14
|
|
data/README.md
CHANGED
@@ -34,7 +34,9 @@ in config/environments/production.rb
|
|
34
34
|
|
35
35
|
Don't use config.log_tags.
|
36
36
|
|
37
|
-
|
37
|
+
### To define where to send messages to, either:
|
38
|
+
|
39
|
+
#### create config/fluent-logger.yml
|
38
40
|
|
39
41
|
development:
|
40
42
|
fluent_host: '127.0.0.1'
|
@@ -54,7 +56,7 @@ create config/fluent-logger.yml
|
|
54
56
|
tag: 'foo'
|
55
57
|
messages_type: 'string'
|
56
58
|
|
57
|
-
|
59
|
+
#### set an environment variable FLUENTD_URL
|
58
60
|
|
59
61
|
http://fluentd.example.com:42442/foo?messages_type=string
|
60
62
|
|
@@ -62,7 +64,17 @@ or set an environment variable FLUENTD_URL
|
|
62
64
|
* fluent_port: The port number of Fluentd.
|
63
65
|
* tag: The tag of the Fluentd event.
|
64
66
|
* messages_type: The type of log messages. 'string' or 'array'.
|
65
|
-
|
67
|
+
|
68
|
+
#### pass a settings object to ActFluentLoggerRails::Logger.new
|
69
|
+
|
70
|
+
config.logger = ActFluentLoggerRails::Logger.
|
71
|
+
new(settings: {
|
72
|
+
host: '127.0.0.1',
|
73
|
+
port: 24224,
|
74
|
+
tag: 'foo',
|
75
|
+
messages_type: 'string'})
|
76
|
+
|
77
|
+
If it is 'string', the log messages is a String.
|
66
78
|
```
|
67
79
|
2013-01-18T15:04:50+09:00 foo {"messages":"Started GET \"/\" for 127.0.0.1 at 2013-01-18 15:04:49 +0900\nProcessing by TopController#index as HTML\nCompleted 200 OK in 635ms (Views: 479.3ms | ActiveRecord: 39.6ms)"],"level":"INFO"}
|
68
80
|
```
|
@@ -71,6 +83,7 @@ or set an environment variable FLUENTD_URL
|
|
71
83
|
2013-01-18T15:04:50+09:00 foo {"messages":["Started GET \"/\" for 127.0.0.1 at 2013-01-18 15:04:49 +0900","Processing by TopController#index as HTML","Completed 200 OK in 635ms (Views: 479.3ms | ActiveRecord: 39.6ms)"],"level":"INFO"}
|
72
84
|
```
|
73
85
|
|
86
|
+
|
74
87
|
You can add any tags at run time.
|
75
88
|
|
76
89
|
logger[:foo] = "foo value"
|
@@ -11,19 +11,21 @@ module ActFluentLoggerRails
|
|
11
11
|
# Severity label for logging. (max 5 char)
|
12
12
|
SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY)
|
13
13
|
|
14
|
-
def self.new(config_file: Rails.root.join("config", "fluent-logger.yml"), log_tags: {})
|
14
|
+
def self.new(config_file: Rails.root.join("config", "fluent-logger.yml"), log_tags: {}, settings: {})
|
15
15
|
Rails.application.config.log_tags = [ ->(request) { request } ] unless log_tags.empty?
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
if (0 == settings.length)
|
17
|
+
fluent_config = if ENV["FLUENTD_URL"]
|
18
|
+
self.parse_url(ENV["FLUENTD_URL"])
|
19
|
+
else
|
20
|
+
YAML.load(ERB.new(config_file.read).result)[Rails.env]
|
21
|
+
end
|
22
|
+
settings = {
|
23
|
+
tag: fluent_config['tag'],
|
24
|
+
host: fluent_config['fluent_host'],
|
25
|
+
port: fluent_config['fluent_port'],
|
26
|
+
messages_type: fluent_config['messages_type'],
|
27
|
+
}
|
28
|
+
end
|
27
29
|
level = SEV_LABEL.index(Rails.application.config.log_level.to_s.upcase)
|
28
30
|
logger = ActFluentLoggerRails::FluentLogger.new(settings, level, log_tags)
|
29
31
|
logger = ActiveSupport::TaggedLogging.new(logger)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: act-fluent-logger-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAHARA Yoshinori
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|