Permalink
Browse files

whitespeces

  • Loading branch information...
1 parent 7fa62db commit cbd0e87dd9ca14cc0213f87fd5a22a2959d67214 @mkristian committed May 9, 2010
@@ -6,7 +6,7 @@ class AbstractLoggerFacade
def format(exception)
(": #{exception.message}:\n\t#{exception.backtrace.join("\n\t") if exception.backtrace }") if exception
end
-
+
def _debug(msg)
raise NotImplementedError
end
@@ -23,7 +23,7 @@ def _error(msg)
raise NotImplementedError
end
- public
+ public
attr_reader :name
@@ -3,15 +3,15 @@
module Slf4r
class LoggerFacade < AbstractLoggerFacade
-
+
attr_reader :logger
-
+
def initialize(name)
super
@logger = ::Log4r::Logger::Repository[name] || ::Log4r::Logger.new(name)
end
- public
+ public
def debug?
@logger.level == 0
@@ -44,6 +44,6 @@ def error?
def _error(msg)
@logger.error(msg)
end
-
+
end
end
View
@@ -5,10 +5,10 @@ def initialize(name)
@name = name
end
- public
+ public
attr_reader :name
-
+
def debug?
false
end
@@ -39,7 +39,7 @@ def _error(msg)
@logger.error(msg)
end
- public
+ public
def debug?
@logger.debug?
@@ -12,7 +12,7 @@
Log4r::Logger.root.level = Log4r::DEBUG
-out = Log4r::FileOutputter.new('logfile',
+out = Log4r::FileOutputter.new('logfile',
:filename => (basedir + 'tmp' + 'log4r.txt').to_s,
:trunc=>false,
:level => Log4r::DEBUG)
View
@@ -2,17 +2,17 @@
require Pathname(__FILE__).dirname.expand_path + 'spec_helper'
def Slf4r.flush(klass)
remove_const(klass.to_sym) if const_defined? klass.to_sym
-end
+end
def behave_as_logger(logger)
filename = logger.name
describe logger.name do
-
+
it 'should have a name' do
logger.name.should == filename
logger.name.should_not be_nil
end
-
+
it 'should log into a file - no method args' do
len1 = File2String.new("tmp/#{filename}.txt").length
logger.debug()
@@ -28,7 +28,7 @@ def behave_as_logger(logger)
len1 = File2String.new("tmp/#{filename}.txt").length
len1.should > len2
end
-
+
it 'should log into a file - via block' do
len1 = File2String.new("tmp/#{filename}.txt").length
logger.debug{}
@@ -44,7 +44,7 @@ def behave_as_logger(logger)
len1 = File2String.new("tmp/#{filename}.txt").length
len1.should > len2
end
-
+
it 'should log into a file - exception' do
exception = StandardError.new
len1 = File2String.new("tmp/#{filename}.txt").length
@@ -61,6 +61,6 @@ def behave_as_logger(logger)
len1 = File2String.new("tmp/#{filename}.txt").length
len1.should > len2
end
-
+
end
end
View
@@ -1,5 +1,5 @@
class File2String < String
-
+
def initialize(file)
content = ''
f = File.open(file, "r")
@@ -7,7 +7,7 @@
logger = ::Logger.new(basedir + 'tmp' + 'wrapped.txt')
logger.level == ::Logger::DEBUG
-
+
Slf4r::LoggerFacade4WrappedLogger.logger = logger
behave_as_logger(Slf4r::LoggerFacade.new('wrapped'))

0 comments on commit cbd0e87

Please sign in to comment.