act-fluent-logger-rails 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb3b269dca0af21e27b94fe5fc0470ea8368f6d7
4
- data.tar.gz: 1d8d7858797a83437b6af1ba5d6c434c31e41c82
3
+ metadata.gz: 550119ac05199783efccabc275c43ce73de465b3
4
+ data.tar.gz: 67e8d75dda8d2d08a5fd42f725e0c6a09bc34f6e
5
5
  SHA512:
6
- metadata.gz: 9ba8d6eb2601eadb7aa8e1f0a91fcd8c9f0fd79c69832d11e66eb72a9b0284d917b6069c132978a4269b29329a0742c01cb99a331f0b6794af7aceb324acb4e7
7
- data.tar.gz: a4b00ac33e2140b85f798fdd5e063124b7e31debb1a17213ba51ba68900c38a4d3ef6e5bdabf9605f3c74b415ca0dd0d939b3eb65ccdfa0fb96f4d3e353f7c08
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
- create config/fluent-logger.yml
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
- or set an environment variable FLUENTD_URL
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
- If it is 'string', the log messages is a String.
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
- fluent_config = if ENV["FLUENTD_URL"]
17
- self.parse_url(ENV["FLUENTD_URL"])
18
- else
19
- YAML.load(ERB.new(config_file.read).result)[Rails.env]
20
- end
21
- settings = {
22
- tag: fluent_config['tag'],
23
- host: fluent_config['fluent_host'],
24
- port: fluent_config['fluent_port'],
25
- messages_type: fluent_config['messages_type'],
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)
@@ -1,3 +1,3 @@
1
1
  module ActFluentLoggerRails
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
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.8
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-14 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec