Sha256: be846123a91ba7f88f14c77a5035648bf4b688fb43278a6268166315f16777a3

Contents?: true

Size: 953 Bytes

Versions: 12

Compression:

Stored size: 953 Bytes

Contents

require 'logger'

# use either $ACTIVE_RDF_LOG for logging or current directory
location = ENV['ACTIVE_RDF_LOG'] || $stdout # "#{Dir.pwd}/activerdf.log"
location = $stdout if location == "STDOUT"
$activerdflog = Logger.new(location, 1, 100*1024)
    
# if user has specified loglevel we use that, otherwise we use default level
# in the environment variable ACTIVE_RDF_LOG_LEVEL we expect numbers, which we 
# have to convert
if ENV['ACTIVE_RDF_LOG_LEVEL'].nil?
  $activerdflog.level = Logger::WARN
else
  $activerdflog.level = ENV['ACTIVE_RDF_LOG_LEVEL'].to_i
end

class Logger
  def debug_pp(message, variable)  
    if variable.respond_to?(:join)
      if variable.empty?
        debug(sprintf(message, "empty"))
      else 
        debug(sprintf(message, variable.join(', ')))        
      end
    else
      if variable.nil?
        debug(sprintf(message, 'empty'))
      else
        debug(sprintf(message, variable))
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activerdf-1.6.3 lib/active_rdf_log.rb
activerdf-1.6.8 lib/active_rdf_log.rb
activerdf-1.5 lib/active_rdf_log.rb
activerdf-1.6.1 lib/active_rdf_log.rb
activerdf-1.6.10 lib/active_rdf_log.rb
activerdf-1.6.11 lib/active_rdf_log.rb
activerdf-1.6.2 lib/active_rdf_log.rb
activerdf-1.6.4 lib/active_rdf_log.rb
activerdf-1.6.5 lib/active_rdf_log.rb
activerdf-1.6.6 lib/active_rdf_log.rb
activerdf-1.6 lib/active_rdf_log.rb
activerdf-1.6.9 lib/active_rdf_log.rb