Sha256: e2ddb7516e195b1aff7044708450cbfbebac37ce1e0b4c37df5f4ce797b381d9

Contents?: true

Size: 694 Bytes

Versions: 25

Compression:

Stored size: 694 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}]"]
          @logger.add_appenders 'stdout' unless Napa.env.test?
          @logger.add_appenders "log/#{Napa.env}.log"
        end

        @logger
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
napa-0.1.10 lib/napa/logger/logger.rb
napa-0.1.7 lib/napa/logger/logger.rb
napa-0.1.6 lib/napa/logger/logger.rb
napa-0.1.4 lib/napa/logger/logger.rb
napa-0.1.3 lib/napa/logger/logger.rb