Sha256: e6774659065e2b12560cc212550fa51baf06992dd3876c7a2e10134d652b9d48

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 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 directly
    development:
      apikey: "YOUR_API_KEY"
      database: myapp
      debug_mode: true  # enable debug mode
    
    # logging via td-agent (fluent)
    production:
      agent: "localhost:24224"
      tag: td.myapp
    
    # disable logging
    test:

== Logging events

You can log anytime using 'TD.event.post' method:

    class MyClass
      def mymethod
        TD.event.post('table_name', {:foo=>:bar})
      end
    end

== Rails extension

In rails application, you can use 'TD.event.attribute' to set static attribute to all events:

    class ApplicationController
      def authenticate
        # set 'uid' attribute to succeeding event logs
        TD.event.attribute[:uid] = 198
      end
    end

    class MyController < ApplicationController
      def mymethod
        authenticate()
        # this event includes 'uid' attribute
        TD.event.post('table_name', {:foo=>:bar})
      end
    end


== Copyright

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
td-logger-0.3.7 README.rdoc
td-logger-0.3.6 README.rdoc
td-logger-0.3.5 README.rdoc
td-logger-0.3.4 README.rdoc
td-logger-0.3.3 README.rdoc
td-logger-0.3.2 README.rdoc
td-logger-0.3.1 README.rdoc