Sha256: c569c3e2191f2a2cda3277ad9294c6a1c1893f461138e803a273a27fe8b777b2

Contents?: true

Size: 474 Bytes

Versions: 2

Compression:

Stored size: 474 Bytes

Contents

module Dalia

  module MiniGraphite

    class Logger
      attr_reader :debug_mode

      def initialize(debug_mode = true)
        @debug_mode = debug_mode
      end

      def debug(message)
        return unless debug_mode

        result = "Dalia::MiniGraphite [#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}]: #{message}"

        if defined? ::Rails
          ::Rails.logger.info result
        else
          Kernel.puts result
        end
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mini_graphite-0.2.1 lib/mini_graphite/logger.rb
mini_graphite-0.0.5 lib/mini_graphite/logger.rb