Sha256: 6e1a35acb8bd01d8c15c725347d7ceaff04c8a8e9100e7f4d6bf256ab4e701a8

Contents?: true

Size: 618 Bytes

Versions: 5

Compression:

Stored size: 618 Bytes

Contents

module Qujo
  module Concerns
    module Logging
      extend ActiveSupport::Concern

      included do
        def logger
          @logger ||= Qujo.logger
        end

        def debug(msg)
          _log(:debug, msg) if Rails.env.development?
        end

        def info(msg)
          _log(:info, msg)
        end

        def warn(msg)
          _log(:warn, msg)
        end

        def error(msg)
          _log(:error, msg)
        end

        protected

        def _log(sev, msg)
          logger.send(sev, msg)
          self.log << {severity: sev, message: msg}
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qujo-0.1.4 lib/qujo/concerns/logging.rb
qujo-0.1.3 lib/qujo/concerns/logging.rb
qujo-0.1.2 lib/qujo/concerns/logging.rb
qujo-0.1.1 lib/qujo/concerns/logging.rb
qujo-0.1.0 lib/qujo/concerns/logging.rb