Motion::Lager 🍺
Full featured logger for use in RubyMotion apps.
Installation
Add this line to your application's Gemfile:
gem 'motion-lager'
And then execute:
$ bundle
Usage
-
Initialize an instance of the logger. Tip: assign it to a global (like
$log
) for easy access anywhere in your app.logger = Motion::Lager.new(level: 'debug') # default
-
Next, call a log level method and pass the message or object that you'd like to log. Log level methods are:
debug
,info
(orlog
),warn
, anderror
. You can also specify the name of a color if you'd like to override the default text color for that log level. You can also specify the background color as the third argument.logger.debug 'My debug message' logger.debug my_object # pretty print objects logger.debug 'Success!', :green logger.warn 'Warning: Black on Yellow!', :black, :yellow
Color Options
Note: Actual color may vary depending on console preferences. Example from Terminal app:
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request