Sha256: fb4605b1c358c372d546c00c35e13e83d9ce3bb7c0e06ee8473bbe81e59f0f84

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

crystal.register :logger do
  if defined?(SILENCE_LOGGER)
    logger = Logger.new nil
  else
    config = crystal[:config]
    if config and config.root? and File.exist?("#{config.root}/log")
      logger = ActiveSupport::BufferedLogger.new crystal.config.log_path
      logger.level = ActiveSupport::BufferedLogger.const_get config.log_level.to_s.upcase
      logger.auto_flushing = false if crystal.config.production?        
    elsif config and config.test?
      logger = Logger.new nil
    elsif config
      logger = Logger.new STDOUT
      logger.warn "No log folder!"
    else
      logger = Logger.new STDOUT
      logger.warn "Config not initialized!"
    end    
  end  
  logger
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
crystal-0.0.13 lib/crystal/environment/logger.rb
crystal-0.0.12 lib/crystal/environment/logger.rb
crystal_ext-0.0.11 lib/crystal/environment/logger.rb