Sha256: 4c9a857546d3dd39c938b21f4cdda6d5f55efb3aaeda83ac0eeb67066a5641cf

Contents?: true

Size: 498 Bytes

Versions: 7

Compression:

Stored size: 498 Bytes

Contents

require 'logger'

module ActiveHook
  class << self
    STDOUT.sync = true

    def log
      @log ||= Log.new
    end
  end

  class Log
    def initialize
      @log = ::Logger.new(STDOUT)
      @log.formatter = proc do |_severity, datetime, _progname, msg|
        "#{msg}\n"
      end
    end

    def info(msg)
      @log.info("[ \e[32mOK\e[0m ] #{msg}")
    end

    def err(msg, action: :no_exit)
      @log.info("[ \e[31mER\e[0m ] #{msg}")
      exit 1 if action == :exit
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
activehook-0.1.9 lib/activehook/log.rb
activehook-0.1.8 lib/activehook/log.rb
activehook-0.1.7 lib/activehook/log.rb
activehook-0.1.6 lib/activehook/log.rb
activehook-0.1.5 lib/activehook/log.rb
activehook-0.1.4 lib/activehook/log.rb
activehook-0.1.3 lib/activehook/log.rb