Sha256: 597223a5beaa1092e8571b3187864ef797628e702e9e4e730613e249be069ed8
Contents?: true
Size: 932 Bytes
Versions: 2
Compression:
Stored size: 932 Bytes
Contents
module Rails module LabeledLog module Logging def self.included(base) base.extend(ClassMethods) base.send(:prepend, InstanceMethods) end module ClassMethods Rails::LabeledLog::LEVELS.each do |level| define_method("log_#{level}".to_sym) do |message| log_labeled(level, message) end end private def log_labeled(level, message) Rails::LabeledLog::Logger.new(self.name).send(level, message) end end module InstanceMethods attr_reader :logger def initialize(*args) @logger = Rails::LabeledLog::Logger.new(self.class.name) super end private Rails::LabeledLog::LEVELS.each do |level| define_method("log_#{level}".to_sym) do |message| logger.send(level, message) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails-labeled_log-0.0.2 | lib/rails/labeled_log/logging.rb |
rails-labeled_log-0.0.1 | lib/rails/labeled_log/logging.rb |