Coder Social home page Coder Social logo

rack-key_value_logger's Introduction

Build Status

What

Structured, key-value logging for your rack apps. Inspired by lograge.

Why?

Application logs are an incredibly rich source of information. But digging out the information can be extremely painful if your logs are not structured in an easily parsable manner.

Rack::KeyValueLogger logs key-value pairs, where the key and value are separated by a "=" character. Pairs are separated by pipe ("|") characters. Here's an example of what a log line looks like:

ts=2013-04-26T01:14:36Z|method=GET|url=/homepage|params=page=2|user_id=123|scheme=http|user_agent=curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5|remote_ip=127.0.0.1|http_version=HTTP/1.1|requested_content_type=text/html|log_source=key_value_logger|status=200|content-length=111|content_type=text/html|runtime=21.553

Get Started

gem 'rack-key_value_logger'

Sinatra

class MyApp < Sinatra::Base
  use Rack::KeyValueLogger
end

Rails

module MyApp
  class Application < Rails::Application
    # ...
    config.middleware.use "Rack::KeyValueLogger"
  end
end

Configuration

A number of configuration options are supported when adding Rack::KeyValueLogger to the middleware stack.

  • :log_failure_response_bodies - true or false. Logs the entire response body to the response_body key on 40x responses. Defaults to false.
  • :ignore_paths - A regular expression of paths we should not log.
  • :logger - A Logger instance. Defaults to Logger($stdout).
  • :user_id - A string key at which the current user's id is stored in env["rack.session"]. Defaults to "user_id".

rack-key_value_logger's People

Contributors

ajsharp avatar anveo avatar

Watchers

Bobby Wilson avatar Zachary Kim avatar Matthew avatar  avatar hubert huang avatar Josh Aronson avatar Chase Martyn avatar Devon St.Clair avatar Kevin Urrutia avatar Shane Mac avatar Adam LaFave avatar Jamin Jantz avatar Marco Suarez avatar James Cloos avatar Jeff Morris Jr. avatar Eric Jorgenson avatar Daniel Pearson avatar Christopher Jenkins avatar Peter Palko avatar Chelsey Frank avatar Giovanni Vatieri avatar Robert Thompson avatar Erica avatar Amanda Fick avatar Jess Colombo avatar Angela Meyer avatar  avatar  avatar Joe Masilotti avatar Nicole Maneth avatar  avatar Brenda Cook avatar Paul Hyoseong Kang avatar Libby Rodriguez avatar Cesario Uy avatar Alex Clink avatar  avatar  avatar Benjamin Reynolds avatar Sam Distaso avatar  avatar Joshua Reinhardt avatar Kameron Ahler avatar

rack-key_value_logger's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.