'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
module.exports = {
- fileScope,
gotResponseLogData,
logTruncate,
pick,
setSymmetricDifference,
properURLComponentName,
-};
\ No newline at end of file
+};
const common = require('./common');
const Enum = require('./enum');
const { ValidationError } = require('./errors');
+const { fileScope } = require('@squeep/log-helper');
-const _fileScope = common.fileScope(__filename);
+const _fileScope = fileScope(__filename);
const noDotPathRE = /(\/\.\/|\/\.\.\/)/;
const v6HostRE = /\[[0-9a-f:]+\]/;
"version": "1.3.0",
"license": "ISC",
"dependencies": {
+ "@squeep/log-helper": "^1.0.0",
"@squeep/web-linking": "^1.0.8",
"got": "^13.0.0",
"iconv": "^3.0.1",
"integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
"dev": true
},
+ "node_modules/@squeep/log-helper": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@squeep/log-helper/-/log-helper-1.0.0.tgz",
+ "integrity": "sha512-i61ECZLWQI2rhkXj9pDzH1Md5ICghL9zvh5QFVo0BTayuSrdS9SWkJ6gV1qWki/Xz6SuE0y0y145NyHlvOuVaw==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/@squeep/web-linking": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@squeep/web-linking/-/web-linking-1.0.8.tgz",
"integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
"dev": true
},
+ "@squeep/log-helper": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@squeep/log-helper/-/log-helper-1.0.0.tgz",
+ "integrity": "sha512-i61ECZLWQI2rhkXj9pDzH1Md5ICghL9zvh5QFVo0BTayuSrdS9SWkJ6gV1qWki/Xz6SuE0y0y145NyHlvOuVaw=="
+ },
"@squeep/web-linking": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@squeep/web-linking/-/web-linking-1.0.8.tgz",
"author": "Justin Wind <jwind-npm@squeep.com>",
"license": "ISC",
"dependencies": {
+ "@squeep/log-helper": "^1.0.0",
"@squeep/web-linking": "^1.0.8",
"got": "^13.0.0",
"iconv": "^3.0.1",
const common = require('../../lib/common');
describe('common', function () {
- describe('fileScope', function () {
- it('names a file path', function () {
- const filename = 'lib/foo/bar.js';
- const result = common.fileScope(filename)('baz');
- assert(result.endsWith(':bar:baz'));
- });
- it('names an index path', function () {
- const filename = 'lib/foo/index.js';
- const result = common.fileScope(filename)('baz');
- assert(result.endsWith(':foo:baz'));
- });
- }); // fileScope
describe('pick', function () {
it('picks', function () {
});
}); // properURLComponentName
-}); // common
\ No newline at end of file
+}); // common