README.md in alephant-logger-0.0.2 vs README.md in alephant-logger-0.1.0

- old
+ new

@@ -42,15 +42,56 @@ def calls_logger Alephant::Logger.set_logger(CustomLogger.new) logger.warn "SUCH CUSTOM. MUCH LOG." end end +``` +### AWS CloudWatch Metrics + +```ruby +require "aws-sdk" +require "alephant/logger" +require "alephant/logger/cloudwatch_decorator" + +AWS.config( + :region => "eu-west-1", + :access_key_id => "ACCESS_KEY_ID", + :secret_access_key => "SECRET_ACCESS_KEY", + :session_token => "SESSION_TOKEN" +) + +LOGGER = Alephant::Logger::CloudWatchDecorator.new( + Logger.new("app.log"), "SomeCloudWatchMetricNameSpace" +) + +Alephant::Logger.set_logger LOGGER + +class Foo + include Alephant::Logger + + def initialize + logger.info "some info" + logger.debug "much debug" + logger.error "great error" + logger.warn "so warn" + logger.fatal "ooh fatal" + + # We set the value of the metric to 123 + logger.metric({:name => "SomeMetricName", :unit => "Count", :value => 123}) + + # Notice that no :value key is specified, meaning we'll increment the last seen value + # If this metric hasn't been set within the last hour then we'll reset the value back to zero + logger.metric({:name => "SomeMetricName", :unit => "Count"}) + end +end + +Foo.new ``` ## Contributing -1. Fork it ( http://github.com/<my-github-username>/alephant-logger/fork ) +1. Fork it ( http://github.com/BBC-News/alephant-logger/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request