Sha256: 6ce3ac103c98eb445d5a7c60bc78a886a6489e16ab13a9b051f44ad8c93a7b33

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

require_relative 'constants'

module Pbin
  class Logger
    INFO_PREFIX       = '[>]'
    WARNING_PREFIX    = '[!]'
    ERROR_PREFIX      = '[x]'

    def initialize
      puts "#{now} Logging to #{LOGFILE}"
      @log = File.open(LOGFILE, 'ab')
    end

    def now
      "#{Time.now.strftime("[%Y-%m-%d %H:%M:%S]")}"
    end

    def info(text)
      "#{now} #{INFO_PREFIX} #{text}"
    end

    def warning(text)
      "#{now} #{WARNING_PREFIX} #{error}"
    end

    def error(text)
      "#{now} #{ERROR_PREFIX} #{error}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pbin-0.1.0 lib/pbin/logger.rb