Sha256: 652db99e2dd38b3bd63465c0f84097e6a122e48ba9aa82587bcf4a45c8a571ab

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

module Endow
  class Logger

    #class_attribute :logger
    #self.logger = nil

    def self.log_connection( service, attempt )
      log "#{green_prefix} #{service.class.name} (Attempt #{attempt})"
    end

    def self.log_graceful_error( msg )
      log "#{red_prefix} #{msg}"
    end

    def self.log( msg )
      return unless logger
      #TODO make this more adaptable
      logger.info( msg )
    end

    def self.logger
      Endow.configuration.logger
    end

    def self.green_prefix
      #TODO change to another ANSI library
      "#{indention}[#{ANSI.green { label }}]"
    end

    def self.red_prefix
      #TODO change to another ANSI library
      "#{indention}[#{ANSI.red { error_label }}]"
    end

    def self.label
      "Service Connection"
    end

    def self.error_label
      "Service ERROR"
    end

    def self.indention
      "  "
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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