@diegoh/api-request-logger
TypeScript icon, indicating that this package has built-in type declarations

4.1.0 • Public • Published

@diegoh/api-request-logger

Build License: MIT Package Version

Koa middleware to log requests using the provided logger.

Usage

Initialise the module by providing a logger with error and info methods.

To log a request pass a koa ctx object as a parameter after initialisation.

Example

const myLogger = require('./logger');
const setupRequestLogger = require('@diegoh/api-request-logger');
const logRequest = setupRequestLogger(myLogger);

logRequest(ctx);

Development

  1. Create a new branch from master with a name relevant to the changes you're making. git branch -b my-new-feature-description
  2. Push the branch and open a Pull Request (PR).
  3. Request a code review.
  4. Squash merge your commits and keep things tidy.

Unit Tests

npm run test:unit

Coverage

npm run test:coverage

Lint

npm run lint or npm run lint:fix to automatically fix any linting issues.

CI/CD

This project uses GitHub actions for CI/CD. The following secrets are required to publish this package.

  • NPM_TOKEN

Readme

Keywords

none

Package Sidebar

Install

npm i @diegoh/api-request-logger

Weekly Downloads

0

Version

4.1.0

License

MIT

Unpacked Size

23.8 kB

Total Files

45

Last publish

Collaborators

  • diegoh