© 2016-2018 Resurface Labs LLC
Logging usage of Ruby cloud apps, with user privacy by design.
- Installing With Bundler
- Logging From Rails Controller
- Logging From Rack Middleware
- Logging From Sinatra
- Logging With API
- Protecting User Privacy
Requires Ruby 2.x. No other dependencies to conflict with your app.
Installing With Bundler
Add this line to your Gemfile:
Then install with Bundler:
Logging From Rails Controller
require 'resurfaceio/all' class MyController < ApplicationController around_action HttpLoggerForRails.new( url: 'https://...', rules: 'include strict' ) end
Logging From Rack Middleware
require 'resurfaceio/all' use HttpLoggerForRack, url: 'https://...', rules: 'include strict' run <...>
Logging From Sinatra
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.
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 (
but logging rules are easily customized to meet the needs of any application.