act-fluent-logger-rails 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9e28f2538881b7eb28b8f09685cc092a4b602e5e
4
+ data.tar.gz: 236175fa5424912c12231b24f16ae47dd187832f
5
+ SHA512:
6
+ metadata.gz: e302fef91fb4d21bfd52b92e029da7d14a129cab26eee6640bf96006378da41901c35b8d99128120103b28596fb1820c869f4e89d22992456e37d9a0beba7eb9
7
+ data.tar.gz: 9c772565e1c5db6a976501aaa73a92d476b5098da7d25cad2df50496e2106c83f4381577e8e121c384c8837d0bcec4234f33e9afd543a6d8631cf5e3b5b75d40
@@ -1,3 +1,7 @@
1
+ ## 0.1.0 / September 16 2013
2
+
3
+ * Rails 4.0.0
4
+
1
5
  ## 0.0.4 / January 19 2013
2
6
 
3
7
  * Add messages_type parameter to fluent-logger.yml to specifying
@@ -19,5 +19,5 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_development_dependency "rspec"
21
21
  gem.add_runtime_dependency "fluent-logger"
22
- gem.add_runtime_dependency "rails"
22
+ gem.add_runtime_dependency "rails", "~> 4.0.0"
23
23
  end
@@ -3,8 +3,12 @@ require 'fluent-logger'
3
3
 
4
4
  module ActFluentLoggerRails
5
5
 
6
- class Logger < ::ActiveSupport::TaggedLogging
7
- def initialize
6
+ module Logger
7
+
8
+ # Severity label for logging. (max 5 char)
9
+ SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY)
10
+
11
+ def self.new
8
12
  config_file = Rails.root.join("config", "fluent-logger.yml")
9
13
  fluent_config = YAML.load(ERB.new(config_file.read).result)[Rails.env]
10
14
  settings = {
@@ -13,29 +17,31 @@ module ActFluentLoggerRails
13
17
  port: fluent_config['fluent_port'],
14
18
  messages_type: fluent_config['messages_type'],
15
19
  }
16
- @level = SEV_LABEL.index(Rails.application.config.log_level.to_s.upcase)
17
- super(::ActFluentLoggerRails::FluentLogger.new(settings, @level))
20
+ level = SEV_LABEL.index(Rails.application.config.log_level.to_s.upcase)
21
+ logger = ActFluentLoggerRails::FluentLogger.new(settings, level)
22
+ logger.formatter ||= ActiveSupport::Logger::SimpleFormatter.new
23
+ logger.formatter.extend ActiveSupport::TaggedLogging::Formatter
24
+ logger.extend ActiveSupport::TaggedLogging
25
+ logger.extend self
18
26
  end
19
27
 
20
28
  def add(severity, message = nil, progname = nil, &block)
21
- return true if severity < @level
29
+ return true if severity < level
22
30
  message = (block_given? ? block.call : progname) if message.blank?
23
31
  return true if message.blank?
24
- @logger.add_message(severity, message)
32
+ add_message(severity, message)
25
33
  true
26
34
  end
27
35
 
28
36
  def tagged(*tags)
29
37
  super(*tags)
30
38
  ensure
31
- @logger.flush
39
+ flush
32
40
  end
33
41
 
34
- # Severity label for logging. (max 5 char)
35
- SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY)
36
42
  end
37
43
 
38
- class FluentLogger < ActiveSupport::BufferedLogger
44
+ class FluentLogger < ActiveSupport::Logger
39
45
  def initialize(options, level=DEBUG)
40
46
  self.level = level
41
47
  port = options[:port]
@@ -1,3 +1,3 @@
1
1
  module ActFluentLoggerRails
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,64 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: act-fluent-logger-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - TAHARA Yoshinori
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-18 00:00:00.000000000 Z
11
+ date: 2013-09-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
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
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: fluent-logger
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
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
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
47
+ version: 4.0.0
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
61
- version: '0'
54
+ version: 4.0.0
62
55
  description: Fluent logger
63
56
  email:
64
57
  - read.eval.print@gmail.com
@@ -78,26 +71,25 @@ files:
78
71
  - lib/act-fluent-logger-rails/version.rb
79
72
  homepage: https://github.com/actindi/act-fluent-logger-rails
80
73
  licenses: []
74
+ metadata: {}
81
75
  post_install_message:
82
76
  rdoc_options: []
83
77
  require_paths:
84
78
  - lib
85
79
  required_ruby_version: !ruby/object:Gem::Requirement
86
- none: false
87
80
  requirements:
88
- - - ! '>='
81
+ - - '>='
89
82
  - !ruby/object:Gem::Version
90
83
  version: '0'
91
84
  required_rubygems_version: !ruby/object:Gem::Requirement
92
- none: false
93
85
  requirements:
94
- - - ! '>='
86
+ - - '>='
95
87
  - !ruby/object:Gem::Version
96
88
  version: '0'
97
89
  requirements: []
98
90
  rubyforge_project:
99
- rubygems_version: 1.8.24
91
+ rubygems_version: 2.0.3
100
92
  signing_key:
101
- specification_version: 3
93
+ specification_version: 4
102
94
  summary: Fluent logger
103
95
  test_files: []