Sha256: 576f7174d2b163de8210c2cc3657c31f327f31b8c3586e0d54b428dbecbaa11b

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

require 'logger'

STDOUT.sync = true

module Travis
  class LogFormatter < Logger::Formatter
    def call(severity, timestamp, progname, msg)
      "#{String === msg ? msg : msg.inspect}\n"
    end
  end

  class << self
    def logger
      @logger ||= Logger.new(STDOUT).tap do |logger|
        logger.formatter = LogFormatter.new
      end
    end

    def logger=(logger)
      @logger = logger
    end
  end

  module Logging
    def self.included(base)
      base.extend(self)
    end

    def log(*args)
      logger.info(*args)
      STDOUT.flush
    end

    def logger
      Travis.logger
    end

    def notice(message)
      "\e[33m#{message}\e[0m"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/travis/logging.rb