{"id":22747506,"url":"https://github.com/resurfaceio/logger-nodejs","last_synced_at":"2025-04-14T11:40:23.930Z","repository":{"id":44120287,"uuid":"83514903","full_name":"resurfaceio/logger-nodejs","owner":"resurfaceio","description":"Log API calls with Node.js","archived":false,"fork":false,"pushed_at":"2024-02-27T20:31:11.000Z","size":217,"stargazers_count":16,"open_issues_count":10,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T00:45:05.874Z","etag":null,"topics":["api-logger","apollo-server","apollo-server-express","express-middleware","http-logger","logger-nodejs","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-01T05:21:52.000Z","updated_at":"2023-04-07T03:47:43.000Z","dependencies_parsed_at":"2024-06-21T05:44:40.214Z","dependency_job_id":"310483d9-54ae-4845-bf0f-45e3b3100b65","html_url":"https://github.com/resurfaceio/logger-nodejs","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/resurfaceio%2Flogger-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/resurfaceio","download_url":"https://codeload.github.com/resurfaceio/logger-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248874207,"owners_count":21175790,"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","apollo-server","apollo-server-express","express-middleware","http-logger","logger-nodejs","nodejs"],"created_at":"2024-12-11T03:16:10.658Z","updated_at":"2025-04-14T11:40:23.899Z","avatar_url":"https://github.com/resurfaceio.png","language":"JavaScript","readme":"# resurfaceio-logger-nodejs\nEasily log API requests and responses to your own \u003ca href=\"https://resurface.io\"\u003esecurity data lake\u003c/a\u003e.\n\n[![npm](https://img.shields.io/npm/v/resurfaceio-logger)](https://badge.fury.io/js/resurfaceio-logger)\n[![CodeFactor](https://www.codefactor.io/repository/github/resurfaceio/logger-nodejs/badge)](https://www.codefactor.io/repository/github/resurfaceio/logger-nodejs)\n[![License](https://img.shields.io/github/license/resurfaceio/logger-nodejs)](https://github.com/resurfaceio/logger-nodejs/blob/master/LICENSE)\n[![Contributing](https://img.shields.io/badge/contributions-welcome-green.svg)](https://github.com/resurfaceio/logger-nodejs/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_npm\"\u003eInstalling With npm\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#logging_from_express_middleware\"\u003eLogging From Express Middleware\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#logging_from_apollo_server_on_express\"\u003eLogging From Apollo Server on Express\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#logging_from_express_route\"\u003eLogging From Specific Express Routes\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 Node.js 10.x or later, and Axios http client. No other dependencies to conflict with your app.\n\n\u003ca name=\"installing_with_npm\"/\u003e\n\n## Installing With npm\n\n```\nnpm install resurfaceio-logger --save\n```\n\n\u003ca name=\"logging_from_express_middleware\"/\u003e\n\n## Logging From Express Middleware\n\nAfter \u003ca href=\"#installing_with_npm\"\u003einstalling the module\u003c/a\u003e, add a `HttpLoggerForExpress` instance to your app, after\nany body parsers in use.\n\n```js\nconst express = require('express');\nconst app = express();\n\n// add body parsers\n\nconst resurfaceio = require('resurfaceio-logger');\nresurfaceio.HttpLoggerForExpress.add(app, {\n    url: 'http://localhost:7701/message', \n    rules: 'include debug'\n});\n\n// define routes\n```\n\n\u003ca name=\"logging_from_koa_middleware\"/\u003e\n\n## Logging From Koa Middleware\n\nAfter \u003ca href=\"#installing_with_npm\"\u003einstalling the module\u003c/a\u003e, add a `HttpLoggerForKoa` instance to your app, after\nany body parsers in use.\n\n```js\nconst Koa = require('koa');\nconst app = new Koa();\n\n// add body parsers\n\nconst resurfaceio = require('resurfaceio-logger');\nresurfaceio.HttpLoggerForKoa.add(app, {\n    url: 'http://localhost:7701/message', \n    rules: 'include debug'\n});\n\n```\n\n\u003ca name=\"logging_from_apollo_server_on_express\"/\u003e\n\n## Logging From Apollo Server on Express\n\nAfter \u003ca href=\"#installing_with_npm\"\u003einstalling the module\u003c/a\u003e, add a `HttpLoggerForExpress` instance before calling `applyMiddleware`.\n\n```js\nconst app = express();\n\nconst resurfaceio = require('resurfaceio-logger');\nresurfaceio.HttpLoggerForExpress.add(app, {\n    url: 'http://localhost:7701/message', \n    rules: 'include debug'\n});\n\nconst server = new ApolloServer({ ... });\n\nserver.applyMiddleware({ app });\n```\n\n\u003ca name=\"logging_from_express_route\"/\u003e\n\n## Logging From Specific Express Routes\n\nAfter \u003ca href=\"#installing_with_npm\"\u003einstalling the module\u003c/a\u003e, create a logger and call it from the routes of interest.\n\n```js\nconst express = require('express');\nconst app = express();\n\nconst resurfaceio = require('resurfaceio-logger');\nconst logger = new resurfaceio.HttpLogger({\n    url: 'http://localhost:7701/message',\n    rules: 'include debug'\n});\n\napp.get('/', function (request, response) {\n    response.render('pages/index', function (e, html) {\n        response.status(200).send(html);\n        resurfaceio.HttpMessage.send(logger, request, response, html);\n    });\n});\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-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fresurfaceio%2Flogger-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fresurfaceio%2Flogger-nodejs/lists"}