Permalink
Browse files

provide debug? etc flags for compatibility

Change-Id: I9c775f85a3d24d349685c70edfb9cff7aaa4d839
  • Loading branch information...
Brad Midgley
Brad Midgley committed May 18, 2012
1 parent e36886a commit b96ec1192d961925d91e17ca3831f8547489d918
@@ -50,6 +50,10 @@ def define_log_helper(level)
define_method(level) {|*args,&block|
log(level, *args,&block)
}
+
+ define_method(level.to_s + '?') {
+ LOG_LEVELS[log_level] >= LOG_LEVELS[level]
+ }
end
def define_logf_helper(name, level)
@@ -1,5 +1,5 @@
module VCAP
module Logging
- VERSION = '1.0.1'
+ VERSION = '1.0.2'
end
end
@@ -101,6 +101,19 @@
block_called.should be_false
end
+ it 'should indicate if a level is active' do
+ @levels.keys.each do |level|
+ @logger.log_level = level
+ @logger.send(level.to_s + '?').should be_true
+ end
+ @logger.log_level = :info
+ @logger.debug?.should be_false
+
+ @logger.log_level = :fatal
+ @logger.info?.should be_false
+ @logger.debug?.should be_false
+ end
+
it "should add an 'exception' tag when data is a kind of Exception" do
@logger.log_level = :info
ex = StandardError.new("Testing 123")

0 comments on commit b96ec11

Please sign in to comment.