Sha256: 38cb3f7f494b6ef55dd0e0cdd59ac227ceab7c8cb53a68265fe22b3b60577648

Contents?: true

Size: 876 Bytes

Versions: 4

Compression:

Stored size: 876 Bytes

Contents

# encoding: UTF-8

require_relative 'nil_logger'

module GoodData
  class << self
    attr_writer :logger

    # Turn logging on
    #
    # ### Example
    #
    #     GoodData.logging_on
    #
    def logging_on
      GoodData.logger = Logger.new(STDOUT) if logger.is_a? NilLogger
    end

    # Turn logging on
    #
    # ### Example
    #
    #     GoodData.logging_off
    #
    def logging_off
      GoodData.logger = NilLogger.new
    end

    def logging_on?
      !GoodData.logger.instance_of?(NilLogger)
    end

    # Returns the logger instance. The default implementation
    # does not log anything
    # For some serious logging, set the logger instance using
    # the logger= method
    #
    # ### Example
    #
    #     require 'logger'
    #     GoodData.logger = Logger.new(STDOUT)
    #
    def logger
      @logger ||= NilLogger.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gooddata-0.6.11 lib/gooddata/core/logging.rb
gooddata-0.6.10 lib/gooddata/core/logging.rb
gooddata-0.6.9 lib/gooddata/core/logging.rb
gooddata-0.6.8 lib/gooddata/core/logging.rb