Sha256: 000281748e779d700daf8c23779fd0e99a4d1b2b9b68f4610c0a3ff666bd5752

Contents?: true

Size: 904 Bytes

Versions: 6

Compression:

Stored size: 904 Bytes

Contents

# encoding: UTF-8

require_relative 'nil_logger'
require_relative 'threaded'

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

6 entries across 6 versions & 1 rubygems

Version Path
gooddata-0.6.7 lib/gooddata/core/logging.rb
gooddata-0.6.6 lib/gooddata/core/logging.rb
gooddata-0.6.5 lib/gooddata/core/logging.rb
gooddata-0.6.4 lib/gooddata/core/logging.rb
gooddata-0.6.3 lib/gooddata/core/logging.rb
gooddata-0.6.2 lib/gooddata/core/logging.rb