Skip to content
Ruby library for usage logging
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib/resurfaceio
spec/unit
.gitignore
.rspec
API.md
CONTRIBUTING.md
Gemfile
Gemfile.lock
LICENSE.md
NOTICES.md
README.md
resurfaceio-logger.gemspec

README.md

resurfaceio-logger-ruby

© 2016-2018 Resurface Labs LLC

Logging usage of Ruby cloud apps, with user privacy by design.

Gem Version

Contents

Dependencies

Requires Ruby 2.x. No other dependencies to conflict with your app.

Installing With Bundler

Add this line to your Gemfile:

gem 'resurfaceio-logger'

Then install with Bundler: bundle install

Logging From Rails Controller

After installing the gem, add an around_action to your Rails controller.

require 'resurfaceio/all'

class MyController < ApplicationController
  
  around_action HttpLoggerForRails.new(
    url: 'https://...', 
    rules: 'include strict'
  )

end

Logging From Rack Middleware

After installing the gem, add these lines below to config.ru, before the final 'run' statement.

require 'resurfaceio/all'

use HttpLoggerForRack,
  url: 'https://...',
  rules: 'include strict'

run <...>

Logging From Sinatra

After installing the gem, create a logger and call it from the routes of interest.

require 'sinatra'
require 'resurfaceio/all'

logger = HttpLogger.new(
  url: 'https://...', 
  rules: 'include strict'
)

get '/' do
  response_body = '<html>Hello World</html>'
  logger.log request, response, response_body
  response_body
end

post '/' do
  status 401
  logger.log request, response
  ''
end

Logging With API

Loggers can be directly integrated into your application using our API. This requires the most effort compared with the options described above, but also offers the greatest flexibility and control.

API documentation

Protecting User Privacy

Loggers always have an active set of rules that control what data is logged and how sensitive data is masked. All of the examples above apply a predefined set of rules (include strict), but logging rules are easily customized to meet the needs of any application.

Logging rules documentation

You can’t perform that action at this time.