ernie 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +4 -0
  2. data/ernie.gemspec +2 -2
  3. data/lib/ernie.rb +15 -13
  4. metadata +4 -4
@@ -1,3 +1,7 @@
1
+ = 2.5.2 / 2010-11-23
2
+ * Bug Fixes
3
+ * Don't do extra logging work unless necessary
4
+
1
5
  = 2.5.1 / 2010-11-22
2
6
  * Bug Fixes
3
7
  * Prevent ernie from trying to start in ernie bin
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.6'
5
5
 
6
6
  s.name = 'ernie'
7
- s.version = '2.5.1'
8
- s.date = '2010-11-22'
7
+ s.version = '2.5.2'
8
+ s.date = '2010-11-23'
9
9
  s.rubyforge_project = 'ernie'
10
10
 
11
11
  s.summary = "Ernie is a BERT-RPC server implementation."
@@ -3,7 +3,7 @@ require 'bert'
3
3
  require 'logger'
4
4
 
5
5
  class Ernie
6
- VERSION = '2.5.1'
6
+ VERSION = '2.5.2'
7
7
 
8
8
  class << self
9
9
  attr_accessor :mods, :current_mod, :log
@@ -123,8 +123,8 @@ class Ernie
123
123
  # Loops forever
124
124
  def self.start
125
125
  self.procline('starting')
126
- self.log.info("(#{Process.pid}) Starting")
127
- self.log.debug(self.mods.inspect)
126
+ self.log.info("(#{Process.pid}) Starting") if self.log.level <= Logger::INFO
127
+ self.log.debug(self.mods.inspect) if self.log.level <= Logger::DEBUG
128
128
 
129
129
  input = IO.new(3)
130
130
  output = IO.new(4)
@@ -138,34 +138,36 @@ class Ernie
138
138
 
139
139
  unless iruby
140
140
  puts "Could not read BERP length header. Ernie server may have gone away. Exiting now."
141
- self.log.info("(#{Process.pid}) Could not read BERP length header. Ernie server may have gone away. Exiting now.")
141
+ if self.log.level <= Logger::INFO
142
+ self.log.info("(#{Process.pid}) Could not read BERP length header. Ernie server may have gone away. Exiting now.")
143
+ end
142
144
  exit!
143
145
  end
144
146
 
145
147
  if iruby.size == 4 && iruby[0] == :call
146
148
  mod, fun, args = iruby[1..3]
147
149
  self.procline("#{mod}:#{fun}(#{args})")
148
- self.log.info("-> " + iruby.inspect)
150
+ self.log.info("-> " + iruby.inspect) if self.log.level <= Logger::INFO
149
151
  begin
150
152
  res = self.dispatch(mod, fun, args)
151
153
  oruby = t[:reply, res]
152
- self.log.debug("<- " + oruby.inspect)
154
+ self.log.debug("<- " + oruby.inspect) if self.log.level <= Logger::DEBUG
153
155
  write_berp(output, oruby)
154
156
  rescue ServerError => e
155
157
  oruby = t[:error, t[:server, 0, e.class.to_s, e.message, e.backtrace]]
156
- self.log.error("<- " + oruby.inspect)
157
- self.log.error(e.backtrace.join("\n"))
158
+ self.log.error("<- " + oruby.inspect) if self.log.level <= Logger::ERROR
159
+ self.log.error(e.backtrace.join("\n")) if self.log.level <= Logger::ERROR
158
160
  write_berp(output, oruby)
159
161
  rescue Object => e
160
162
  oruby = t[:error, t[:user, 0, e.class.to_s, e.message, e.backtrace]]
161
- self.log.error("<- " + oruby.inspect)
162
- self.log.error(e.backtrace.join("\n"))
163
+ self.log.error("<- " + oruby.inspect) if self.log.level <= Logger::ERROR
164
+ self.log.error(e.backtrace.join("\n")) if self.log.level <= Logger::ERROR
163
165
  write_berp(output, oruby)
164
166
  end
165
167
  elsif iruby.size == 4 && iruby[0] == :cast
166
168
  mod, fun, args = iruby[1..3]
167
169
  self.procline("#{mod}:#{fun}(#{args})")
168
- self.log.info("-> " + [:cast, mod, fun, args].inspect)
170
+ self.log.info("-> " + [:cast, mod, fun, args].inspect) if self.log.level <= Logger::INFO
169
171
  begin
170
172
  self.dispatch(mod, fun, args)
171
173
  rescue Object => e
@@ -174,9 +176,9 @@ class Ernie
174
176
  write_berp(output, t[:noreply])
175
177
  else
176
178
  self.procline("invalid request")
177
- self.log.error("-> " + iruby.inspect)
179
+ self.log.error("-> " + iruby.inspect) if self.log.level <= Logger::ERROR
178
180
  oruby = t[:error, t[:server, 0, "Invalid request: #{iruby.inspect}"]]
179
- self.log.error("<- " + oruby.inspect)
181
+ self.log.error("<- " + oruby.inspect) if self.log.level <= Logger::ERROR
180
182
  write_berp(output, oruby)
181
183
  end
182
184
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ernie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 5
9
- - 1
10
- version: 2.5.1
9
+ - 2
10
+ version: 2.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Preston-Werner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-22 00:00:00 -08:00
18
+ date: 2010-11-23 00:00:00 -08:00
19
19
  default_executable: ernie
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency