Alephant::Logger::Cloudwatch
AWS CloudWatch driver for the alephant-logger gem.
Installation
Add this line to your application's Gemfile:
gem 'alephant-logger-cloudwatch'
And then execute:
$ bundle
Or install it yourself as:
$ gem install alephant-logger-cloudwatch
Usage
require "alephant/logger"
require "alephant/logger/cloudwatch"
cloudwatch_driver = Alephant::Logger::CloudWatch.new(:namespace => "my_namespace")
logger = Alephant::Logger.setup cloudwatch_driver
logger.metric("FooBar", :unit => "Count", :value => 1)
You can also prefill in default values when creating a new instance of the logger (and still override individual settings for each logger call):
require "alephant/logger"
require "alephant/logger/cloudwatch"
# Define defaults
cloudwatch_driver = Alephant::Logger::CloudWatch.new(
:namespace => "my_namespace",
:unit => "Count",
:value => 1,
:dimensions => { :foo => "bar" }
)
logger = Alephant::Logger.setup cloudwatch_driver
# Override specific settings for this logger call
logger.metric("FooBar", :unit => "Percent", :value => 2)
# Use predefined defaults
logger.metric("BazQux")
Contributing
- Fork it ( https://github.com/BBC-News/alephant-logger-cloudwatch/fork )
- 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 a new Pull Request