Skip to content

Commit

Permalink
fixed printout of backtraces, added actual log methods to ruby_logger…
Browse files Browse the repository at this point in the history
…_adapter
  • Loading branch information
mkristian committed Feb 10, 2009
1 parent 7ab0593 commit 1ce0035
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
9 changes: 6 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

require 'rubygems'
require 'hoe'
require './lib/slf4r.rb'
require './lib/slf4r/version.rb'

Hoe.new('slf4r', Slf4r::VERSION) do |p|
# p.rubyforge_name = 'slf4rx' # if different than lowercase project name
p.developer('kristian', 'FIX@example.com')
p.rubyforge_name = 'slf4r' # if different than lowercase project name
p.summary = 'Slf4r provides a uniform interface for instantiating und using of a logger'
p.url = 'http://slf4r.rubyforge.com/'
p.developer('mkristian', 'm.kristian@web.de')
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
p.remote_rdoc_dir = '' # Release to root
end

desc 'Install the package as a gem.'
Expand Down
18 changes: 17 additions & 1 deletion lib/ruby_logger_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@ class Logger
def initialize(*args)
@logger = ::Slf4r::LoggerFacade.new(:root)
end


def debug(msg, &block)
@logger.debug(msg, &block)
end

def info(msg, &block)
@logger.info(msg, &block)
end

def warn(msg, &block)
@logger.warn(msg, &block)
end

def error(msg, &block)
@logger.error(msg, &block)
end

def method_missing(method, *args, &block)
@logger.send(method, *args, &block) if @logger.respond_to?(method)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/slf4r/abstract_logger_facade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AbstractLoggerFacade
protected

def format(exception)
": #{exception.message}:\n\t#{exception.backtrace.join('\n\t')}" if exception
": #{exception.message}:\n\t#{exception.backtrace.join("\n\t")}" if exception
end

def _debug(msg)
Expand Down
2 changes: 1 addition & 1 deletion lib/slf4r/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Slf4r
VERSION = '0.1.0'
VERSION = '0.1.1'
end

0 comments on commit 1ce0035

Please sign in to comment.