logbert 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/logbert/formatters.rb +10 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWZhNDk3MmU1ZjgxMDViZjhhZjE5NTZhNDVhYjJlY2RmZjljOTdkYw==
4
+ YWFkNDk4ZjEyM2IxNTZjOGNiOTM0NzAxMmVmMjY5ZjZiMzU5M2JlZQ==
5
5
  data.tar.gz: !binary |-
6
- ZmQwMjJiYjMxNjk4OGYxMTg3OGIzZTkzYzRiYTQ3NmFlN2I2ZWMxNQ==
6
+ NWU4MmNmY2IxMjdlMjI1ZTkyNDNiYzkxNTE3NmM5N2Y3Y2EzZmJjYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjEwNTNmYWU2ODNjMGI2NDA4ZjEzOTA2YzhkMGQyNmZjMDRlNzJiMWY2NDYw
10
- ZGFlNTMzZTIxZDZmYzg0NjkxY2EzZTc3NzllMjFmOWVlYjc5Y2IwNjFjYTRi
11
- MWE4MmY4NGRmOTM3Zjc3YTE5NTdhNDBhZDM5N2VmZjg1NGEwYzE=
9
+ ZjFlMTk3NWE2YWMwZjBlZjk2NzMzZjJjM2FmMzYxYTZjYzI3NDhhNTNjZjVi
10
+ Mzk4MzNhNjc2N2U2YTFiMWE2MzRiMjMwOGE3OTgwMmNmNmY4ZDNjMWRkN2Vm
11
+ OTAwZjQ1NzMxNjkxNGYwNzgwNDg3OTVhYWI4Y2M3ZDAyOTFkZTU=
12
12
  data.tar.gz: !binary |-
13
- MjE4NmE1ZTMzY2U2MDBkNWFhMzY0YTAzYTY0YTM4Y2MzYTU2MDMxZDU3MDQw
14
- MDgzNGI5ZTE4NzBiY2FkMjdiNzM2ZjE4YjAwODdkYThjMGI0NWJjNmJlMjgy
15
- OTQwNWU3NzIyZjZjNTNmN2U0OGVjMmUxZDdlMmYwNDc5OWYyOTI=
13
+ ZTc4ZmQzZDk3ZTVjNzQ4MTk4YTk0Yjc1NzU0MzVkOTE2MmJiZWQwNDQ2ZGRm
14
+ MjYxZmE2M2Y1MmQ2MDA5N2VjOGMzMjY5Mzk5ODc3NGRhNDhlNGIxMzdjM2M5
15
+ ZDJiNmU1OGY3ZDBmNzc3M2MzYmQ3ODlhYTZhNDY2MDg1NmE4ZDg=
@@ -2,36 +2,36 @@
2
2
  require 'logbert/message'
3
3
 
4
4
  module Logbert
5
-
5
+
6
6
  module Formatters
7
-
7
+
8
8
  class Formatter
9
9
  def format(msg)
10
10
  raise NotImplementedError
11
11
  end
12
12
  end
13
-
13
+
14
14
  class SimpleFormatter < Formatter
15
15
  def format(msg)
16
16
  level = msg.level.to_s.upcase.ljust(8)
17
17
  output = "#{level} [time='#{msg.time}' pid='#{msg.pid}' logger='#{msg.logger}'] : #{msg.content}"
18
18
  if msg.exception
19
- output = [output, "\n\nException information:\n", msg.exception.class, ": ", msg.exception.message, "\n"]
19
+ output = [output, "\n\nException information:\n", msg.exception[:exc_class], ": ", msg.exception[:exc_message], "\n"]
20
20
 
21
- backtrace = backtrace = msg.exception.backtrace
21
+ backtrace = backtrace = msg.exception[:exc_backtrace]
22
22
  if backtrace
23
23
  output += [backtrace.join($/), "\n\n"]
24
24
  else
25
25
  output << "(Backtrace is unavailable)\n\n"
26
26
  end
27
-
27
+
28
28
  output = output.join
29
29
  end
30
30
  return output
31
31
  end
32
32
  end
33
-
34
-
33
+
34
+
35
35
  class ProcFormatter < Formatter
36
36
  attr_accessor :proc
37
37
 
@@ -39,12 +39,12 @@ module Logbert
39
39
  raise ArgumentError, "ProcFormatter must be initialized with a block" unless block_given?
40
40
  @proc = block
41
41
  end
42
-
42
+
43
43
  def format(msg)
44
44
  @proc.call msg
45
45
  end
46
46
  end
47
-
47
+
48
48
  def self.fmt(&block)
49
49
  ProcFormatter.new(&block)
50
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logbert
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lauber