log4r-fluent 0.0.1 → 0.0.2
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.
- data/lib/log4r/fluent_outputter.rb +5 -4
- data/log4r-fluent.gemspec +2 -2
- data/spec/log4r-fluent_spec.rb +14 -3
- data/spec/spec_helper.rb +0 -1
- metadata +4 -6
- data/lib/log4r-fluent/version.rb +0 -5
- data/lib/log4r-fluent.rb +0 -7
@@ -4,14 +4,15 @@ require 'fluent-logger'
|
|
4
4
|
|
5
5
|
module Log4r
|
6
6
|
class FluentOutputter < Log4r::Outputter
|
7
|
+
VERSION = "0.0.2"
|
7
8
|
attr_accessor :tag
|
8
9
|
|
9
10
|
def initialize(_name, hash={})
|
10
11
|
super(_name, hash)
|
11
|
-
@tag = hash[:tag]
|
12
|
-
host = hash[:host]
|
13
|
-
port = hash[:port]
|
14
|
-
::Fluent::Logger::FluentLogger.open(nil, host: host, port: port)
|
12
|
+
@tag = hash[:tag] || hash["tag"] || 'test'
|
13
|
+
host = hash[:host] || hash["host"] || 'localhost'
|
14
|
+
port = hash[:port] || hash["port"] || 24224
|
15
|
+
::Fluent::Logger::FluentLogger.open(nil, host: host, port: port.to_i)
|
15
16
|
end
|
16
17
|
|
17
18
|
def canonical_log(logevent)
|
data/log4r-fluent.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'log4r
|
4
|
+
require 'log4r/fluent_outputter'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "log4r-fluent"
|
8
|
-
gem.version = Log4r::
|
8
|
+
gem.version = Log4r::FluentOutputter::VERSION
|
9
9
|
gem.authors = ["aoyagikouhei"]
|
10
10
|
gem.email = ["aoyagi.kouhei@gmail.com"]
|
11
11
|
gem.description = %q{Log4R Outputter for fluent}
|
data/spec/log4r-fluent_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
describe Log4r::
|
2
|
+
describe Log4r::FluentOutputter do
|
3
3
|
it "initialize" do
|
4
4
|
obj = Log4r::FluentOutputter.new("name")
|
5
5
|
obj.tag.should == "test"
|
@@ -9,5 +9,16 @@ describe Log4r::Fluent do
|
|
9
9
|
obj = Log4r::FluentOutputter.new("name", {tag: 'hi'})
|
10
10
|
obj.tag.should == "hi"
|
11
11
|
end
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
it "initialize with tag str key" do
|
14
|
+
obj = Log4r::FluentOutputter.new("name", {"tag" => 'hi'})
|
15
|
+
obj.tag.should == "hi"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "logged" do
|
19
|
+
obj = Log4r::FluentOutputter.new("name", {tag: 'hi'})
|
20
|
+
logger = Log4r::Logger.new("name")
|
21
|
+
logevent = Log4r::LogEvent.new(1, logger, nil, "test")
|
22
|
+
obj.canonical_log(logevent)
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log4r-fluent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: log4r
|
@@ -56,8 +56,6 @@ files:
|
|
56
56
|
- LICENSE.txt
|
57
57
|
- README.md
|
58
58
|
- Rakefile
|
59
|
-
- lib/log4r-fluent.rb
|
60
|
-
- lib/log4r-fluent/version.rb
|
61
59
|
- lib/log4r/fluent_outputter.rb
|
62
60
|
- log4r-fluent.gemspec
|
63
61
|
- spec/log4r-fluent_spec.rb
|
@@ -76,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
74
|
version: '0'
|
77
75
|
segments:
|
78
76
|
- 0
|
79
|
-
hash:
|
77
|
+
hash: -2609584178595742175
|
80
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
79
|
none: false
|
82
80
|
requirements:
|
@@ -85,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
83
|
version: '0'
|
86
84
|
segments:
|
87
85
|
- 0
|
88
|
-
hash:
|
86
|
+
hash: -2609584178595742175
|
89
87
|
requirements: []
|
90
88
|
rubyforge_project:
|
91
89
|
rubygems_version: 1.8.24
|
data/lib/log4r-fluent/version.rb
DELETED