Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
120 lines (79 sloc) 2.9 KB


© 2016-2019 Resurface Labs Inc.

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

Gem Version



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
    url: 'https://...', 
    rules: 'include strict'


Logging From Rack Middleware

After installing the gem, add these lines below to, 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 =
  url: 'https://...', 
  rules: 'include strict'

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

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

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.