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.
@@ -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
-
@@ -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
-