Skip to content

Instantly share code, notes, and snippets.

@dchersey
Last active October 25, 2016 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dchersey/4ca2c983602375aedcc121e482236ddc to your computer and use it in GitHub Desktop.
Save dchersey/4ca2c983602375aedcc121e482236ddc to your computer and use it in GitHub Desktop.
simple development and production logging code for rubymotion
class Object
def log_error message, object=nil
if Device.simulator?
mp "ERROR: #{message}"
mp object if object
else
NSLog("ERROR: #{message}: %@\n".to_s, object)
end
end
def log_dev message, object=nil
if Device.simulator?
puts "LOG: #{message}"
mp object if object
elsif App.development? || Module.const_defined?(:CRASHLYTICS_BETA)
NSLog("XX_LOG: #{message}: %@\n".to_s, object)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment