Sha256: 9497a3cdd2d02f8528ddcab278f8926b6166cf52aeaa85195fc556787c88d85b

Contents?: true

Size: 726 Bytes

Versions: 3

Compression:

Stored size: 726 Bytes

Contents

module Napa
  class Logger
    class << self
      def name
        [Napa::Identity.name, Napa::LogTransaction.id].join('-')
      end

      def logger=(logger)
        @logger = logger
      end

      def logger
        unless @logger
          Logging.appenders.stdout(
            'stdout',
            :layout => Logging.layouts.json
          )
          Logging.appenders.file(
            "log/#{Napa.env}.log",
            :layout => Logging.layouts.json
          )

          @logger = Logging.logger["[#{name}]"]
          unless Napa.env.test?
            @logger.add_appenders 'stdout'
          end
          @logger.add_appenders "log/#{Napa.env}.log"
        end

        @logger
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
napa-0.1.2 lib/napa/logger/logger.rb
napa-0.1.1 lib/napa/logger/logger.rb
napa-0.1.0 lib/napa/logger/logger.rb