fluent-plugin-irc 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-irc"
6
- s.version = "0.0.4"
6
+ s.version = "0.0.5"
7
7
  s.authors = ["OKUNO Akihiro"]
8
8
  s.email = ["choplin.choplin@gmail.com"]
9
9
  s.homepage = "https://github.com/choplin/fluent-plugin-irc"
@@ -42,6 +42,7 @@ module Fluent
42
42
  super
43
43
 
44
44
  begin
45
+ @loop = Coolio::Loop.default
45
46
  @conn = create_connection
46
47
  rescue
47
48
  raise Fluent::ConfigError, "failto connect IRC server #{@host}:#{@port}"
@@ -57,7 +58,8 @@ module Fluent
57
58
  chain.next
58
59
 
59
60
  if @conn.closed?
60
- refresh_connection(@conn)
61
+ $log.warn "out_irc: connection is closed. try to reconnect"
62
+ @conn = create_connection
61
63
  end
62
64
 
63
65
  es.each do |time,record|
@@ -75,20 +77,16 @@ module Fluent
75
77
  conn.user = @user
76
78
  conn.real = @real
77
79
  conn.password = @password
78
- conn.attach(Coolio::Loop.default)
80
+ conn.attach(@loop)
79
81
  conn
80
82
  end
81
83
 
82
- def refresh_connection(conn)
83
- conn = create_connection
84
- end
85
-
86
84
  def build_message(record)
87
85
  values = @out_keys.map do |key|
88
86
  begin
89
87
  record.fetch(key).to_s
90
88
  rescue KeyError
91
- $log.warn "out_irc: the specified key '#{key}' not found in record"
89
+ $log.warn "out_irc: the specified key '#{key}' not found in record. [#{record}]"
92
90
  ''
93
91
  end
94
92
  end
@@ -133,6 +131,8 @@ module Fluent
133
131
  m.body = msg.body
134
132
  write m
135
133
  end
134
+ when :error
135
+ $log.warn "out_irc: an error occured. \"#{msg.error_message}\""
136
136
  end
137
137
  rescue
138
138
  #TODO
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-irc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2013-08-21 00:00:00.000000000 Z
12
+ date: 2013-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd