{"id":20481163,"url":"https://github.com/resurfaceio/logger-ruby","last_synced_at":"2025-04-13T14:11:05.152Z","repository":{"id":3596065,"uuid":"50256698","full_name":"resurfaceio/logger-ruby","owner":"resurfaceio","description":"Log API calls with Ruby","archived":false,"fork":false,"pushed_at":"2024-02-29T01:24:41.000Z","size":346,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T05:12:16.266Z","etag":null,"topics":["api-logger","http-logger","logger-ruby","rack-middleware","ruby","sinatra"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/resurfaceio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-01-23T20:21:53.000Z","updated_at":"2023-04-07T03:46:57.000Z","dependencies_parsed_at":"2024-01-12T00:56:54.062Z","dependency_job_id":"b8bbbdf1-6e4f-4201-a8d4-4baffde74c95","html_url":"https://github.com/resurfaceio/logger-ruby","commit_stats":{"total_commits":334,"total_committers":6,"mean_commits":"55.666666666666664","dds":0.05988023952095811,"last_synced_commit":"5880557262166446eab55252b0110d8d78971b50"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/resurfaceio","download_url":"https://codeload.github.com/resurfaceio/logger-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248363361,"owners_count":21091340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-logger","http-logger","logger-ruby","rack-middleware","ruby","sinatra"],"created_at":"2024-11-15T16:07:05.222Z","updated_at":"2025-04-13T14:11:05.125Z","avatar_url":"https://github.com/resurfaceio.png","language":"Ruby","readme":"# resurfaceio-logger-ruby\nEasily log API requests and responses to your own \u003ca href=\"https://resurface.io\"\u003esecurity data lake\u003c/a\u003e.\n\n[![gem](https://badge.fury.io/rb/resurfaceio-logger.svg)](https://badge.fury.io/rb/resurfaceio-logger)\n[![CodeFactor](https://www.codefactor.io/repository/github/resurfaceio/logger-ruby/badge)](https://www.codefactor.io/repository/github/resurfaceio/logger-ruby)\n[![License](https://img.shields.io/github/license/resurfaceio/logger-ruby)](https://github.com/resurfaceio/logger-ruby/blob/master/LICENSE)\n[![Contributing](https://img.shields.io/badge/contributions-welcome-green.svg)](https://github.com/resurfaceio/logger-ruby/blob/master/CONTRIBUTING.md)\n\n## Contents\n\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#dependencies\"\u003eDependencies\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#installing_with_bundler\"\u003eInstalling With Bundler\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#logging_from_rails_controller\"\u003eLogging From Rails Controller\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#logging_from_rack_middleware\"\u003eLogging From Rack Middleware\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#logging_from_sinatra\"\u003eLogging From Sinatra\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#logging_with_api\"\u003eLogging With API\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#privacy\"\u003eProtecting User Privacy\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ca name=\"dependencies\"/\u003e\n\n## Dependencies\n\nRequires Ruby 2.x. No other dependencies to conflict with your app.\n\n\u003ca name=\"installing_with_bundler\"/\u003e\n\n## Installing With Bundler\n\nAdd this line to your Gemfile:\n\n```\ngem 'resurfaceio-logger'\n```\n\nThen install with Bundler: `bundle install`\n\n\u003ca name=\"logging_from_rails_controller\"/\u003e\n\n## Logging From Rails Controller\n\nAfter \u003ca href=\"#installing_with_bundler\"\u003einstalling the gem\u003c/a\u003e, add an `around_action` to your Rails controller.\n\n```ruby\nrequire 'resurfaceio/all'\n\nclass MyController \u003c ApplicationController\n  \n  around_action HttpLoggerForRails.new(\n    url: 'http://localhost:7701/message', \n    rules: 'include debug'\n  )\n\nend\n```\n\n\u003ca name=\"logging_from_rack_middleware\"/\u003e\n\n## Logging From Rack Middleware\n\nAfter \u003ca href=\"#installing_with_bundler\"\u003einstalling the gem\u003c/a\u003e, add these lines below to `config.ru`, before the final\n'run' statement.\n\n```ruby\nrequire 'resurfaceio/all'\n\nuse HttpLoggerForRack,\n  url: 'http://localhost:7701/message',\n  rules: 'include debug'\n\nrun \u003c...\u003e\n```\n\n\u003ca name=\"logging_from_sinatra\"/\u003e\n\n## Logging From Sinatra\n\nAfter \u003ca href=\"#installing_with_bundler\"\u003einstalling the gem\u003c/a\u003e, create a logger and call it from the routes of interest.\n\n```ruby\nrequire 'sinatra'\nrequire 'resurfaceio/all'\n\nlogger = HttpLogger.new(\n  url: 'http://localhost:7701/message', \n  rules: 'include debug'\n)\n\nget '/' do\n  response_body = '\u003chtml\u003eHello World\u003c/html\u003e'\n  HttpMessage.send(logger, request, response, response_body)\n  response_body\nend\n\npost '/' do\n  status 401\n  HttpMessage.send(logger, request, response)\n  ''\nend\n```\n\n\u003ca name=\"logging_with_api\"/\u003e\n\n## Logging With API\n\nLoggers can be directly integrated into your application using our [API](API.md). This requires the most effort compared with\nthe options described above, but also offers the greatest flexibility and control.\n\n[API documentation](API.md)\n\n\u003ca name=\"privacy\"/\u003e\n\n## Protecting User Privacy\n\nLoggers always have an active set of \u003ca href=\"https://resurface.io/rules.html\"\u003erules\u003c/a\u003e that control what data is logged\nand how sensitive data is masked. All of the examples above apply a predefined set of rules (`include debug`),\nbut logging rules are easily customized to meet the needs of any application.\n\n\u003ca href=\"https://resurface.io/rules.html\"\u003eLogging rules documentation\u003c/a\u003e\n\n---\n\u003csmall\u003e\u0026copy; 2016-2024 \u003ca href=\"https://resurface.io\"\u003eGraylog, Inc.\u003c/a\u003e\u003c/small\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fresurfaceio%2Flogger-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fresurfaceio%2Flogger-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fresurfaceio%2Flogger-ruby/lists"}