Skip to content
Node.js library for usage logging
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Update copyright May 25, 2019
test
.gitignore Updating .gitignore Mar 6, 2017
API.md
CONTRIBUTING.md Update copyright May 25, 2019
LICENSE.md
NOTICES.md Add library notices Mar 17, 2017
README.md Update copyright May 25, 2019
package.json Update version to 1.9.3 May 25, 2019

README.md

resurfaceio-logger-nodejs

© 2016-2019 Resurface Labs Inc.

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

Contents

Dependencies

Requires Node.js 6.10.x or later. No other dependencies to conflict with your app.

Installing With npm

npm install resurfaceio-logger --save

Logging From Express Route

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

const express = require('express');
const app = express();

const resurfaceio = require('resurfaceio-logger');
const logger = new resurfaceio.HttpLogger({
    url: 'https://...',
    rules: 'include strict'
});

app.get('/', function (request, response) {
    response.render('pages/index', function (e, html) {
        response.status(200).send(html);
        logger.log(request, response, html);
    });
});

Logging From Express Middleware

After installing the module, add a HttpLoggerForExpress instance to your app, after any body parsers in use.

const express = require('express');
const app = express();

// add body parsers

const resurfaceio = require('resurfaceio-logger');
resurfaceio.HttpLoggerForExpress.add(app, {
    url: 'https://...', 
    rules: 'include strict'
});

// define routes

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.