cabin 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/cabin/logger.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "cabin/namespace"
2
+ require "ap"
2
3
 
3
4
  # This module implements methods that act somewhat like Ruby's Logger class
4
5
  # It is included in Cabin::Channel
@@ -30,6 +31,7 @@ module Cabin::Logger
30
31
  # def info?, def warn? ...
31
32
  # these methods return true if the loglevel allows that level of log.
32
33
  define_method(predicate) do
34
+ @level ||= :info
33
35
  return LEVELS[@level] >= LEVELS[level]
34
36
  end # def info?, def warn? ...
35
37
  end # end defining level-based log methods
@@ -14,7 +14,10 @@ class Cabin::Outputs::StdlibLogger
14
14
  public
15
15
  def <<(data)
16
16
  method = data[:level] || "info"
17
+
18
+ message = "#{data[:message]} #{data.to_json}"
19
+
17
20
  # This will call @logger.info(data) or something similar.
18
- @logger.send(method, data.to_json)
21
+ @logger.send(method, message)
19
22
  end # def <<
20
23
  end # class Cabin::Outputs::StdlibLogger
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cabin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &19828200 !ruby/object:Gem::Requirement
16
+ requirement: &22224480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19828200
24
+ version_requirements: *22224480
25
25
  description: This is an experiment to try and make logging more flexible and more
26
26
  consumable. Plain text logs are bullshit, let's emit structured and contextual logs.
27
27
  email: