Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Logless

Logless will automatically capture logs and diagnostics for your Node.js Lambda or Express.js service.

To use it with Lambdas, simply wrap your function handler, like so:


    var bst = require('bespoken-tools');

    exports.handler = bst.Logless.capture("<SECRET_KEY>", function (event, context) {
        // Lambda code goes here
        context.done(null, "Hello World");
    });

To use it with Express.js, simply wrap configure it with your routes.


    var bst = require('bespoken-tools');

    var logless = bst.Logless.middleware("<SECRET_KEY>");
    app = express();

    app.use(bodyParser.json());
    app.use(logless.requestHandler);

    // Application handlers and routers registered here
    app.post("/", function {
        ...
    });

    // The Logless error handler must be registered last
    app.use(logless.errorHandler);

That's all there is to it. Then you can see all your logs through our handy dashboard!

We will effortlessly capture and format:

  • Request and response payloads
  • Console output (including instrumentation for timing and all debug levels)
  • Error and stack traces

Hierarchy

  • Logless

Index

Properties

Static Domain

Domain: string = "logless.bespoken.tools"

Methods

Static capture

  • capture(source: string, handler: Function): Function
  • Wraps an AWS Lambda function to capture logs and diagnostics

    Parameters

    • source: string

      The secret key for your Logless app

    • handler: Function

    Returns Function

Static disableConsoleLogging

  • disableConsoleLogging(): void

Static enableConsoleLogging

  • enableConsoleLogging(): void
  • Experimental - this uses monkey-patching to trace console output associated with a transaction on ExpressJS The logs that come back associated with a particular log conversation should not be considered completely reliable at this point. ONLY necessary for ExpressJS.

    Returns void

Static logger

Static middleware

  • Returns an object to hold handlers for use in capturing logs and diagnostics with Express.js

    Parameters

    • source: string

      The secret key for your Logless app

    Returns LoglessMiddleware

Generated using TypeDoc