1.1.1 • Published 6 years ago

fetch-with-log v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 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

6 years ago

1.1.0

7 years ago

0.1.0

7 years ago

0.0.31

7 years ago

0.0.30

7 years ago

0.0.29

7 years ago

0.0.28

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago