update devDependencies, eslint config, address lint issues
[squeep-indieauth-helper] / lib / common.js
index c1b8703d58d435a127a80fcfaec70b73358a2a2c..67cb668a751a1c9ac9aaf693880521fbcc26ffc8 100644 (file)
@@ -1,21 +1,5 @@
 'use strict';
 
-const path = require('path');
-const { name: packageName, version: packageVersion } = require('../package');
-
-const libraryIdentifier = `${packageName}@${packageVersion}`;
-
-/**
- * Return a function which combines a part of the filename with a scope, for use in logging.
- * @param {string} filename
- */
-const fileScope = (filename) => {
-  const shortFilename = path.basename(filename, '.js');
-  const fScope = (shortFilename === 'index') ? path.basename(path.dirname(filename)) : shortFilename;
-  return (scope) => [libraryIdentifier, fScope, scope].join(':');
-}
-
-
 /**
  * Pick out useful got response fields.
  * @param {GotResponse} res
@@ -27,6 +11,8 @@ const gotResponseLogData = (res) => {
     'statusMessage',
     'headers',
     'body',
+    'url',
+    'error',
   ]);
   if (typeof res.body === 'string') {
     data.body = logTruncate(data.body, 100);
@@ -103,14 +89,13 @@ const properURLComponentName = (component) => {
     hash: 'fragment',
     protocol: 'scheme',
   }[component] || component;
-}
+};
 
 
 module.exports = {
-  fileScope,
   gotResponseLogData,
   logTruncate,
   pick,
   setSymmetricDifference,
   properURLComponentName,
-};
\ No newline at end of file
+};