Sha256: a370ca6a9ee3385c95401ecd2457d4df091dc8aa87efb23b18698966df82e1c6

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

require 'logger'
require_relative 'log_repository'
require_relative 'log_factory_file_logger'
require_relative 'log_factory_log_formatter'

module RTALogger
  # show log items on console out put
  class LogRepositoryFile < LogRepository
    def initialize(file_path = 'log.txt', period = 'daily', shift_size = 1_048_576)
      super()
      @file_logger = RTALogger::LogFactory.new_file_logger(file_path, period, shift_size)
      @formatter = RTALogger::LogFactory.log_formatter_default
    end

    protected

    def flush_and_clear
      semaphore.synchronize do
        @log_records.each { |log_record| @file_logger.debug(@formatter.format(log_record)) }
      end
      super
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
RTALogger-0.1.4 lib/log_repository_file.rb
RTALogger-0.1.3 lib/log_repository_file.rb
RTALogger-0.1.2 lib/log_repository_file.rb
RTALogger-0.1.1 lib/log_repository_file.rb