fluent-logger 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/.travis.yml +10 -0
- data/AUTHORS +1 -0
- data/COPYING +14 -0
- data/ChangeLog +14 -0
- data/Gemfile +9 -0
- data/README.rdoc +16 -78
- data/Rakefile +18 -0
- data/VERSION +1 -0
- data/fluent-logger.gemspec +44 -0
- data/lib/fluent/logger.rb +8 -36
- data/lib/fluent/logger/{console.rb → console_logger.rb} +2 -1
- data/lib/fluent/logger/fluent_logger.rb +214 -0
- data/lib/fluent/logger/logger_base.rb +34 -0
- data/lib/fluent/logger/null_logger.rb +28 -0
- data/lib/fluent/logger/{test.rb → test_logger.rb} +4 -12
- data/lib/fluent/logger/text_logger.rb +40 -0
- data/lib/fluent/logger/version.rb +1 -1
- data/spec/console_logger_spec.rb +69 -0
- data/spec/fluent_logger_spec.rb +201 -0
- data/spec/logger_base_spec.rb +11 -0
- data/spec/logger_spec.rb +43 -0
- data/spec/null_logger_spec.rb +15 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/support/timecop.rb +8 -0
- data/spec/test_logger_spec.rb +31 -0
- metadata +121 -84
- data/lib/fluent/logger/base.rb +0 -89
- data/lib/fluent/logger/event.rb +0 -118
- data/lib/fluent/logger/fluent.rb +0 -121
- data/lib/fluent/logger/syslog.rb +0 -127
- data/test/event_test.rb +0 -183
- data/test/instance_test.rb +0 -34
- data/test/simple_test.rb +0 -78
- data/test/test_helper.rb +0 -14
data/test/simple_test.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__)+'/test_helper'
|
2
|
-
|
3
|
-
class SimpleTest < Test::Unit::TestCase
|
4
|
-
it 'singleton' do
|
5
|
-
Fluent::Logger::ConsoleLogger.open(STDOUT)
|
6
|
-
|
7
|
-
AccessEvent = Fluent::Logger.create_event('e1', :agent, :action=>'access')
|
8
|
-
LoginEvent = Fluent::Logger.create_event('e2', :user, :action=>'login')
|
9
|
-
|
10
|
-
#=> action="access" agent="foo"
|
11
|
-
AccessEvent.agent('foo').post!
|
12
|
-
|
13
|
-
#=> action="login" user="bar"
|
14
|
-
LoginEvent.user('bar').post!
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'local' do
|
18
|
-
E2_LOG = Fluent::Logger::ConsoleLogger.new(STDOUT)
|
19
|
-
|
20
|
-
E2_AccessEvent = E2_LOG.create_event('e1', :agent, :action=>'access')
|
21
|
-
E2_LoginEvent = E2_LOG.create_event('e2', :user, :action=>'login')
|
22
|
-
|
23
|
-
#=> action="access" agent="foo"
|
24
|
-
E2_AccessEvent.agent('foo').post!
|
25
|
-
|
26
|
-
#=> action="login" user="bar"
|
27
|
-
E2_LoginEvent.user('bar').post!
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'combine' do
|
31
|
-
E3_LOG = Fluent::Logger::ConsoleLogger.new(STDOUT)
|
32
|
-
|
33
|
-
E3_User = E3_LOG.create_event('e1', :name, :age)
|
34
|
-
E3_LoginEvent = E3_LOG.create_event('e2', :action=>'login')
|
35
|
-
E3_BuyEvent = E3_LOG.create_event('e3', :item, :action=>'login')
|
36
|
-
|
37
|
-
e_user = E3_User.name('me').age(24)
|
38
|
-
|
39
|
-
#=> action="login" name="me" age=24
|
40
|
-
E3_LoginEvent.with(e_user).post!
|
41
|
-
|
42
|
-
#=> action="login" name="me" age=24 item="item01"
|
43
|
-
E3_BuyEvent.with(e_user).item("item01").post!
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'update' do
|
47
|
-
E4_LOG = Fluent::Logger::ConsoleLogger.new(STDOUT)
|
48
|
-
|
49
|
-
E4_User = E4_LOG.create_event('e1', :name, :age)
|
50
|
-
E4_AgeChangeEvent = E4_LOG.create_event('e2', :changed_age, :action=>'age_change')
|
51
|
-
E4_BuyEvent = E4_LOG.create_event('e3', :item, :action=>'buy')
|
52
|
-
|
53
|
-
e_user = E4_User.name('me').age(24)
|
54
|
-
|
55
|
-
#=> action="age_change" name="me" age=24 changed_age=25
|
56
|
-
E4_AgeChangeEvent.with(e_user).changed_age(25).post!
|
57
|
-
e_user.age!(25)
|
58
|
-
|
59
|
-
#=> action="buy" name="me" age=25 item="item01"
|
60
|
-
E4_BuyEvent.with(e_user).item("item01").post!
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'combine_update' do
|
64
|
-
E5_LOG = Fluent::Logger::ConsoleLogger.new(STDOUT)
|
65
|
-
|
66
|
-
E5_User = E5_LOG.create_event('e1', :name, :age)
|
67
|
-
E5_Browser = E5_LOG.create_event('e2', :host, :agent)
|
68
|
-
E5_LoginEvent = E5_LOG.create_event('e3', :action=>'login')
|
69
|
-
|
70
|
-
e_user = E5_User.name('me').age(24)
|
71
|
-
e_browser = E5_Browser.host('remoteip').agent('firefox')
|
72
|
-
e_user.with!(e_browser)
|
73
|
-
|
74
|
-
#=> action="login" name="me" age=24 host="remoteip" agent="firefox"
|
75
|
-
E5_LoginEvent.with(e_user).post!
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
data/test/test_helper.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
$LOAD_PATH << File.dirname(__FILE__)+"/../lib"
|
3
|
-
require 'fluent/logger'
|
4
|
-
require 'fileutils'
|
5
|
-
|
6
|
-
class Test::Unit::TestCase
|
7
|
-
#class << self
|
8
|
-
# alias_method :it, :test
|
9
|
-
#end
|
10
|
-
def self.it(name, &block)
|
11
|
-
define_method("test_#{name}", &block)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|