Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

bbc/mozart-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mozart::Logger

Internal gem for setting up structured logging and metrics for use within our Mozart service applications.

It is an abstraction wrapping around our open-source software Alephant Logger.

Installation

Add this line to your application's Gemfile:

group :production do
  gem "mozart-logger", "1.0.0", :git => "git@github.com:bbc/mozart-logger.git"
end

And then execute:

$ bundle install

Setup

require "mozart/logger"

opts = {
  :statsd => {
    :host      => ENV["STATSD_HOST"],
    :port      => 8125,
    :namespace => "mozart-routing"
  },
  :cloudwatch => {
    :namespace => ENV["CLOUDWATCH_NAMESPACE"]
  }
}

Mozart::Logger.setup opts, ENV["APP_LOG_LOCATION"] # configures Alephant Logger

use Rack::CommonLogger, Alephant::Logger.get_logger # optional

Note: you should only provide one key
either :statsd or :cloudwatch
the latter will be ignored if both provided

Usage

require "alephant/logger"

class Foo
  include include Alephant::Logger

  def initialize
    logger.info(
      "event"   => "ClassInitialized",
      "method"  => "#{self.class.name}##{__method__}",
      "someKey" => 123
    )
  end
end

Note: for more details, refer to the following gems
Alephant-Logger-CloudWatch, Alephant-Logger-Statsd and Alephant-Logger-JSON

About

Gem for setting up logging and metrics for Mozart services

Resources

Stars

Watchers

Forks

Packages

No packages published