Socket
Book a DemoInstallSign in
Socket

footprint-log

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

footprint-log

0.1.4
bundlerRubygems
Version published
Maintainers
1
Created
Source

= Footprint Rack Application Logging Tools

{Gem Version}[http://badge.fury.io/rb/footprint-log] {Build Status}[https://travis-ci.org/ipuiu/footprint-log] {Dependency Status}[https://gemnasium.com/ipuiu/footprint-log] {}[https://codeclimate.com/github/ipuiu/footprint-log] {Coverage Status}[https://coveralls.io/r/ipuiu/footprint-log?branch=master] {Inline docs}[http://inch-ci.org/github/ipuiu/footprint-log]

== What is "Footprint" ?

Footprint was started by the need to have a simple and smart way to deal with the logs.

It is composed of:

require 'footprint/log' # some custom loggers.
require 'footprint/middleware' # middleware used to decorate Rack applications.

== How to use it ?

First you should add the gem to your Gemfile:

gem 'footprint-log'

=== Basic Usage

Let's say that we don't care about what logger we use, and we just wish a logger method in our app that acts like a logger instance.

In that case we can do something like this:

require 'sinatra'
require 'footprint/middleware'

class MyApp < Sinatra

    use Footprint::Middleware

    get '/' do
        logger.info 'I can use logger method inside my route!'
    end

end

=== Advanced Usage

Let's say that we care about what logger we use, and we also wish a logger method in our app that acts like a logger instance.

Let's assume we want to use a instance of the Logger class, initialized with log_device as STDOUT.

In that case we can do something like this:

require 'sinatra'
require 'footprint/middleware'

class MyApp < Sinatra

    use Footprint::Middleware do
        set Logger, STDOUT
    end

    get '/' do
        logger.info 'I can use a instance of Logger class, initialized with STDOUT option by calling the logger method inside my route!'
    end

end

Let's assume we want to use the following custom Logger class, initialized with log_device as STDOUT and level as 1 (that is INFO level).

class MyAwesomeLogger < Logger

    def initialize logdev, level
        super logdev, shift_age = 0, shift_size = 1048576
        @level = level
    end

end

In that case we can do something like this:

require 'sinatra'
require 'footprint/middleware'

class MyApp < Sinatra

    use Footprint::Middleware do
        set MyAwesomeLogger, STDOUT, 1
    end

    get '/' do
        logger.info 'I can use a instance of MyAwesomeLogger class, initialized with STDOUT, 1 option by calling the logger method inside my route!'
    end

end

== Contributing to Footprint

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2014 Puiu Ionut. See LICENSE.txt for further details.

FAQs

Package last updated on 19 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.