mini_logger 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/mini_logger.rb +14 -10
  2. data/lib/version.rb +1 -1
  3. metadata +2 -2
data/lib/mini_logger.rb CHANGED
@@ -5,25 +5,29 @@ require 'logger'
5
5
  module MiniLogger
6
6
  class << self
7
7
 
8
- LOG_CHANNEL_KEY = :log_channel
9
- LOG_LEVEL_KEY = :log_level
10
- DEFAULT_CONFIGURATION = { LOG_CHANNEL_KEY=>STDERR, LOG_LEVEL_KEY=>::Logger::INFO }
11
- VALID_METHODS = [:debug, :info, :warn, :error, :fatal, :level, :debug?]
12
-
8
+ DEFAULT_CONFIGURATION = { :log_channel=>STDERR, :log_level=>::Logger::INFO }
9
+ VALID_METHODS = [ :debug, :info, :warn, :error, :fatal ]
13
10
 
14
11
  def method_missing( method, *arguments, &block )
15
12
 
16
13
  self.configure unless @logger
17
- @logger.send( method, arguments ) if VALID_METHODS.include?( method )
14
+
15
+ if VALID_METHODS.include?( method )
16
+
17
+ @logger.send( method, arguments.length == 1 ? arguments[0] : arguments )
18
+ end
18
19
  end
19
20
 
20
21
 
21
- def configure( options=DEFAULT_CONFIGURATION )
22
+ #def configure( options=DEFAULT_CONFIGURATION )
23
+ def configure( atts = DEFAULT_CONFIGURATION )
22
24
 
23
- @logger ||= Logger.new( options[LOG_CHANNEL_KEY] )
24
- @logger.level ||= options[LOG_LEVEL_KEY]
25
+ @logger ||= Logger.new( atts[:log_channel] )
26
+ @logger.level ||= atts[:log_level]
25
27
 
26
28
  self
27
29
  end
28
30
  end
29
- end
31
+ end
32
+
33
+ MiniLogger.fatal( "Yeah!!")
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module Version
2
2
  module Info
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
  end
7
7
 
8
8
  NAME = 'mini_logger'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mini_logger
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Javier Juarez
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-15 00:00:00 +01:00
13
+ date: 2011-02-17 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency