1.1.1 • Published 5 years ago

fetch-with-log v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

fetch-with-log

Creates a function which logs request and response from fetch into passed in function

Installation

npm install fetch-with-log

Usage example

import fetchWithLog from 'fetch-with-log');
// OR
// const fetchWithLog = require('fetch-with-log').default;

const logFunc = args => {
  // do logging magic here
  // args are this shape:
  // {
  //   url, // url requested
  //   options, // request options passed
  //   res, // response object
  //   time; // time taken to make fetch request
  // }

  console.log('some log to analytics for example');
};

const fetch = fetchWithLog({ log: logFunc });

(async function init() {
  const result = await fetch('https://www.google.com', {}).catch(e => {
    console.log(e);
  });
})();
1.1.1

5 years ago

1.1.0

6 years ago

0.1.0

6 years ago

0.0.31

6 years ago

0.0.30

6 years ago

0.0.29

6 years ago

0.0.28

6 years ago

0.0.25

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago