@phenomnomnominal/debug
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -8,2 +8,3 @@ "use strict"; | ||
var module_1 = tslib_1.__importDefault(require("module")); | ||
var path = tslib_1.__importStar(require("path")); | ||
var perf_hooks_1 = require("perf_hooks"); | ||
@@ -21,5 +22,6 @@ var util_1 = require("util"); | ||
DebuggerΩ.prototype.shouldWrap = function (requirePath) { | ||
var isNodeModule = module_1.default.builtinModules.includes(requirePath) || requirePath.includes('node_modules'); | ||
var isIncludedModule = this._include.some(function (regexp) { return regexp.test(requirePath); }); | ||
var isIgnoredModule = this._ignore.some(function (regexp) { return regexp.test(requirePath); }); | ||
var normalisedRequirePath = normalisePath(requirePath); | ||
var isNodeModule = module_1.default.builtinModules.includes(normalisedRequirePath) || normalisedRequirePath.includes('node_modules'); | ||
var isIncludedModule = this._include.some(function (regexp) { return regexp.test(normalisedRequirePath); }); | ||
var isIgnoredModule = this._ignore.some(function (regexp) { return regexp.test(normalisedRequirePath); }); | ||
return !((isNodeModule && !isIncludedModule) || isIgnoredModule); | ||
@@ -117,2 +119,5 @@ }; | ||
} | ||
function normalisePath(filePath) { | ||
return path.sep === path.posix.sep ? filePath : filePath.split(path.sep).join(path.posix.sep); | ||
} | ||
//# sourceMappingURL=debugger.js.map |
{ | ||
"name": "@phenomnomnominal/debug", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Very lazy tool for adding debug logging", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,2 +5,25 @@ # [@phenomnomnominal/debug](https://github.com/phenomnomnominal/debug/) | ||
**`Debug`** is a super lazy way to add debug logging! | ||
**`debug`** is a super lazy way to add debug logging! | ||
## Usage | ||
```typescript | ||
import { debug } from '@phenomnomnominal/debug'; | ||
debug({ enabled: true }); | ||
``` | ||
## Options | ||
```typescript | ||
export type DebugOptions = { | ||
enabled: boolean; // Enable debug logging | ||
time: boolean; // Enable function execution time logging | ||
values: boolean; // Enable argument and return value logging | ||
logPath: string; // Disable stdout logging and print to file at this path | ||
header: string; // Header name for the initial debug log | ||
include: DebugIncludes; // RegExp to match node_modules paths that should be included in the logs | ||
ignore: DebugIgnores; // RegExp to match local paths that should be ignored from the logs | ||
logger: DebugLogger; // Custom logger implementation (Maybe you want to send it via HTTP 🤷♂️) | ||
}; | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22606
29
18
267