@deephaven/log
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -17,7 +17,32 @@ var __extends = (this && this.__extends) || (function () { | ||
import Logger from './Logger'; | ||
import { INFO } from './LoggerLevel'; | ||
import LoggerLevel, { DEBUG2, INFO, SILENT } from './LoggerLevel'; | ||
/** | ||
* Get the default log level to use. | ||
* production mode defaults to INFO. | ||
* development mode defaults to DEBUG2 (most verbose). | ||
* test mode defaults to SILENT. | ||
* Override by setting environment variable `process.env.DEEPHAVEN_LOG_LEVEL` | ||
* @returns {number} The default log level to use | ||
*/ | ||
function getDefaultLevel() { | ||
var envValue = process.env.DEEPHAVEN_LOG_LEVEL; | ||
if (envValue && LoggerLevel[envValue]) { | ||
return LoggerLevel[envValue]; | ||
} | ||
var envLevel = parseInt(envValue !== null && envValue !== void 0 ? envValue : '', 10); | ||
if (!Number.isNaN(envLevel)) { | ||
return envLevel; | ||
} | ||
if (process.env.NODE_ENV === 'test') { | ||
return SILENT; | ||
} | ||
if (process.env.NODE_ENV === 'development') { | ||
return DEBUG2; | ||
} | ||
return INFO; | ||
} | ||
var DefaultLogger = /** @class */ (function (_super) { | ||
__extends(DefaultLogger, _super); | ||
function DefaultLogger(level) { | ||
if (level === void 0) { level = INFO; } | ||
if (level === void 0) { level = getDefaultLevel(); } | ||
var _this = _super.call(this, null, level) || this; | ||
@@ -24,0 +49,0 @@ _this.modules = {}; |
@@ -0,1 +1,2 @@ | ||
export const SILENT: -1; | ||
export const ERROR: 0; | ||
@@ -7,2 +8,3 @@ export const WARN: 1; | ||
declare var _default: Readonly<{ | ||
SILENT: number; | ||
ERROR: number; | ||
@@ -9,0 +11,0 @@ WARN: number; |
@@ -0,1 +1,2 @@ | ||
export var SILENT = -1; | ||
export var ERROR = 0; | ||
@@ -7,2 +8,3 @@ export var WARN = 1; | ||
export default Object.freeze({ | ||
SILENT: SILENT, | ||
ERROR: ERROR, | ||
@@ -9,0 +11,0 @@ WARN: WARN, |
{ | ||
"name": "@deephaven/log", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Deephaven Logger", | ||
@@ -31,3 +31,2 @@ "author": "Deephaven Data Labs LLC", | ||
"start": "cross-env NODE_ENV=development npm run watch", | ||
"prepublishOnly": "run-s build", | ||
"test": "jest --watch", | ||
@@ -60,3 +59,3 @@ "test:ci": "jest --ci", | ||
}, | ||
"gitHead": "2decc54a35c8765c4c1527e5159c3f7a0e7dff06" | ||
"gitHead": "087d3c2c4eb1e261a1897ce5dd394aeb99ebd7b8" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
464
195259
3