Sha256: e1d13f7027debb159cde5e280f5f18f75273552cbe82c1fa1bcafaf33287e3c0

Contents?: true

Size: 923 Bytes

Versions: 6

Compression:

Stored size: 923 Bytes

Contents

require 'yell'
require 'yell-adapters-syslog'

require 'leeroy/helpers'
require 'leeroy/helpers/env'

module Leeroy
  module Helpers
    module Logging
      include Leeroy::Helpers

      # constants
      TRUNCATE_THRESHOLD = 60

      TRACE_FORMAT = "%d [%5L] %p (%M): %m"
      TRACE_LEVELS = [:debug]

      # define a logger
      # Yell.new :stderr, name: self.class.to_s, format: TRACE_FORMAT, trace: TRACE_LEVELS, level: :debug
      if ENV['ENVIRONMENT'] == 'production'
        Yell.new :syslog, name: self.class.to_s, format: TRACE_FORMAT, trace: TRACE_LEVELS, level: :info, facility: :user
      else
        Yell.new :stderr, name: self.class.to_s, format: TRACE_FORMAT, trace: TRACE_LEVELS, level: :debug
      end

      # make this class loggable
      self.class.send :include, Yell::Loggable

      # make logger an instance method
      def logger
        self.class.logger
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
leeroy_app-0.4.0 lib/leeroy/helpers/logging.rb
leeroy_app-0.3.1 lib/leeroy/helpers/logging.rb
leeroy_app-0.3.0 lib/leeroy/helpers/logging.rb
leeroy_app-0.2.1 lib/leeroy/helpers/logging.rb
leeroy_app-0.2.0 lib/leeroy/helpers/logging.rb
leeroy_app-0.1.0 lib/leeroy/helpers/logging.rb