Sha256: 7eb80ec5ff5657a97dc394fee1ceeb72cc42ddae6df37f6fb5acc89167a72d18

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

= Treasure Data logging library for Rails

== Getting Started

Add the following line to your Gemfile:

    gem 'td-logger'

For Rails 2.x (not tested) without Bundler,
edit +environment.rb+ and add to the initalizer block:

    config.gem "td-logger"

And then add +config/treasure_data.yml+ file as following:

    # logging to Treasure Data directry
    development:
      apikey: "YOUR_API_KEY"
      database: myapp
      auto_create_table: true
    
    # logging via td-agent
    production:
      agent: "localhost:24224"
      tag: myapp
    
    # disable logging
    test:

=== Logging actions

Add 'add_td_tracer' line to your controller classes:

    class YourController < ApplicationController
      def myaction
        # ...
      end
      add_td_tracer :myaction, 'mytable'
    end

It logs {"controller":"your","action":"myaction"}. Additionally, routing parameters are included automatically.

You can add environment variables by adding 'extra' option as follows:

    # logs client address on the 'addr' column
    add_td_tracer :myaction, 'mytable', :extra=>{:REMOTE_ADDR=>:addr}

    # logs referer and path info
    add_td_tracer :myaction, 'mytable', :extra=>{:HTTP_REFERER=>:referer, :PATH_INFO=>:path}

Add 'static' option to add constant key-value pairs:

    add_td_tracer :myaction, 'mytable', :static=>{:version=>1}


== Copyright

Copyright:: Copyright (c) 2011 Treasure Data Inc.
License::   Apache License, Version 2.0

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
td-logger-0.1.2 README.rdoc
td-logger-0.1.1 README.rdoc
td-logger-0.1.0 README.rdoc