Sha256: 20453f1e484fdfaf9159a8c1d36217dee4753cf684c2bed2378883137f240466

Contents?: true

Size: 815 Bytes

Versions: 24

Compression:

Stored size: 815 Bytes

Contents

def SugarCube.log(message=nil)
  @log ||= []

  if message.nil?
    return @log
  end

  if suppress?
    log << message
  elsif log?
    SugarCube.stderr(message)
  end

  self
end

def SugarCube.flush_log(notification=nil)
  return unless @log && ! @log.empty?

  output = "SugarCube recorded the following warnings:"
  @log.uniq.each do |message|
    output << "\n"
    output << message
  end
  SugarCube.stderr(output)
  @log = nil
end

def SugarCube.log?(value=nil)
  if value.nil?
    if @logging.nil?
      @logging = (RUBYMOTION_ENV == 'development')
    end
    @logging
  else
    @logging = value
    unless @logging
      @log = nil
    end
  end
end

def SugarCube.suppress?(value=nil)
  if value.nil?
    @suppress
  else
    @suppress = value
    unless @suppress
      @log = nil
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sugarcube-4.0.0 lib/all/sugarcube/log.rb
sugarcube-3.5.0 lib/all/sugarcube/log.rb
sugarcube-3.4.2 lib/all/sugarcube/log.rb
sugarcube-3.4.1 lib/all/sugarcube/log.rb
sugarcube-3.4.0 lib/all/sugarcube/log.rb
sugarcube-3.3.7 lib/all/sugarcube/log.rb
sugarcube-3.3.6 lib/all/sugarcube/log.rb
sugarcube-3.3.5 lib/all/sugarcube/log.rb
sugarcube-3.3.4 lib/all/sugarcube/log.rb
sugarcube-3.3.3 lib/all/sugarcube/log.rb
sugarcube-3.3.2 lib/all/sugarcube/log.rb
sugarcube-3.3.1 lib/all/sugarcube/log.rb
sugarcube-3.3.0 lib/all/sugarcube/log.rb
sugarcube-3.2.0 lib/all/sugarcube/log.rb
sugarcube-3.1.1 lib/all/sugarcube/log.rb
sugarcube-3.1.0 lib/all/sugarcube/log.rb
sugarcube-3.0.8 lib/all/sugarcube/log.rb
sugarcube-3.0.7 lib/all/sugarcube/log.rb
sugarcube-3.0.6 lib/all/sugarcube/log.rb
sugarcube-3.0.5 lib/all/sugarcube/log.rb