Coder Social home page Coder Social logo

thekarel / middy-lesslog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robdasilva/middy-lesslog

0.0 1.0 0.0 420 KB

Middy middleware for `lesslog`, a teeny-tiny and severless-ready logging utility.

License: MIT License

JavaScript 37.04% TypeScript 62.96%

middy-lesslog's Introduction

middy-lesslog

Middy middleware wrapper for lesslog

The middleware registers before, after and onError handlers to log the incoming event, outgoing response or thrown error respectively.

Using lesslog however this debug information will not be logged immediately, but buffered internally. Once an error is thrown any buffered logs will be emitted, preserving their original timestamp and context. No debug information is lost, while still maintaining clutter-free logs the rest of the time. You can learn more about how lesslog processes your logs by reading its documentation.

Installation

$ npm install lesslog middy-lesslog

Note: lesslog is a peer dependency of middy-lesslog.

Usage

import middy from '@middy/core'
import log from 'middy-lesslog'

async function handler(event, context) {
  // Do something meaningful

  return {
    statusCode: 200,
  }
}

export const handler = middy(handler).use(log())

Configuration

There are no configuration options so far. Reach out or open an issue, if you want to see a specific option to be configurable!

Debug

If the DEBUG environment variable is set to either '1', 'on', 'true', or 'yes', the incoming event and outgoing response will not be buffered internally, but instead directly written to process.env.stdout. This behavior is built-in to lesslog.

middy-lesslog's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.