@percy/logger
Advanced tools
Comparing version 1.0.0-beta.36 to 1.0.0-beta.37
@@ -87,3 +87,4 @@ "use strict"; | ||
}), { | ||
deprecated: this.deprecated.bind(this, name) | ||
deprecated: this.deprecated.bind(this, name), | ||
shouldLog: this.shouldLog.bind(this, name) | ||
}); | ||
@@ -97,2 +98,7 @@ } // Ensures that deprecation messages are not logged more than once | ||
this.log(debug, 'warn', `Warning: ${message}`, meta); | ||
} // Returns true or false if the level and debug group can write messages to stdio | ||
shouldLog(debug, level) { | ||
return LOG_LEVELS[level] != null && LOG_LEVELS[level] >= LOG_LEVELS[this.level] && !this.namespaces.exclude.some(ns => ns.test(debug)) && this.namespaces.include.some(ns => ns.test(debug)); | ||
} // Generic log method accepts a debug group, log level, log message, and optional meta | ||
@@ -120,3 +126,3 @@ // information to store with the message and other info | ||
if (this.shouldLog(level, debug)) { | ||
if (this.shouldLog(debug, level)) { | ||
let stdio = this[level === 'info' ? 'stdout' : 'stderr']; | ||
@@ -128,7 +134,2 @@ if (error && this.level !== 'debug') message = error.toString(); | ||
} | ||
} // Returns true or false if the level and debug group can write messages to stdio | ||
shouldLog(level, debug) { | ||
return LOG_LEVELS[level] != null && LOG_LEVELS[level] >= LOG_LEVELS[this.level] && !this.namespaces.exclude.some(ns => ns.test(debug)) && this.namespaces.include.some(ns => ns.test(debug)); | ||
} // Formats messages before they are logged to stdio | ||
@@ -135,0 +136,0 @@ |
{ | ||
"name": "@percy/logger", | ||
"version": "1.0.0-beta.36", | ||
"version": "1.0.0-beta.37", | ||
"license": "MIT", | ||
@@ -14,3 +14,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "babel --root-mode upward src --out-dir dist", | ||
"build": "cross-env NODE_ENV=production babel src --out-dir dist --root-mode upward", | ||
"lint": "eslint --ignore-path ../../.gitignore .", | ||
@@ -26,3 +26,3 @@ "test": "cross-env NODE_ENV=test mocha", | ||
}, | ||
"gitHead": "b50360d0afa6e3b4c6c6bf7f5ef25d39031ca370" | ||
"gitHead": "49828f18be37eba7b6bfb0d45214a9937f8299fe" | ||
} |
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
12221
213