Giter Club home page Giter Club logo

contentful-loghandlers's Introduction

Contentful CDA Request Logger ๐Ÿ“Š๐Ÿ”

This is a simple npm package designed to log and visualize your Contentful Content Delivery API (CDA) requests in the development console. It's perfect for developers working with the Contentful JavaScript SDK. The package includes two main functions: requestLogger and responseLogger.

Installation ๐Ÿ’พ

Install this package as a development dependency:

npm install --save-dev console-logger-contentful

Usage ๐Ÿ› 

Import the requestLogger and responseLogger functions from the module:

import { requestLogger, responseLogger } from 'console-logger-contentful';

Configure requestLogger and responseLogger as interceptors in your Axios instance used with Contentful:

const client = contentful.createClient({
  space: process.env.SPACE_ID,
  environment: process.env.ENVIRONMENT,
  accessToken: process.env.ACCESS_TOKEN,
  requestLogger: requestLogger,
  responseLogger: responseLogger,
});

This setup will log the request ID, timing, cache result, query path, and size of each Contentful CDA request directly in your development console.

Looks like this:

screenshot

Note ๐Ÿ“

  • This package is intended for development use only. Do not install it as a production dependency.
  • The package is designed to work with the Contentful JavaScript SDK. It may not work with other Contentful SDKs or APIs.

Contributing ๐Ÿค

Contributions to the Contentful CDA Request Logger are welcome! Feel free to open a pull request or submit an issue if you have any suggestions or improvements.

License ๐Ÿ“„

This project is licensed under the MIT License - see the LICENSE.md file for details.

Helpful Links ๐Ÿ”—


Feel free to tweak further based on your package details and personal preferences!

contentful-loghandlers's People

Contributors

shanonplace avatar

Stargazers

Allan Hillman avatar

Watchers

 avatar Allan Hillman 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.