Comparing version 1.6.5 to 1.8.1
@@ -1,2 +0,2 @@ | ||
/* Brolog version 1.6.5 */ | ||
/* Brolog version 1.8.1 */ | ||
(function (global, factory) { | ||
@@ -27,3 +27,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
const BROLOG_LEVEL_VAR_NAME = 'BROLOG_LEVEL'; | ||
const BROLOG_MODULE_VAR_NAME = 'BROLOG_MODULE'; | ||
const BROLOG_PREFIX_VAR_NAME = 'BROLOG_PREFIX'; | ||
let level; | ||
@@ -43,3 +43,3 @@ let debugModule; | ||
if (!debugModule) { | ||
debugModule = process.env[BROLOG_MODULE_VAR_NAME]; | ||
debugModule = process.env[BROLOG_PREFIX_VAR_NAME]; | ||
} | ||
@@ -69,3 +69,3 @@ } | ||
const BROLOG_LEVEL = level || DEFAULT_LEVEL; | ||
const BROLOG_MODULE = debugModule || '*'; | ||
const BROLOG_PREFIX = debugModule || '*'; | ||
@@ -190,3 +190,3 @@ /*! | ||
if (typeof filter === 'string') { | ||
this.prefixFilter = new RegExp('^' + filter + '$', 'i'); | ||
this.prefixFilter = new RegExp('^' + filter + '$'); | ||
} | ||
@@ -387,4 +387,4 @@ else if (filter instanceof RegExp) { | ||
} | ||
if (BROLOG_MODULE && BROLOG_MODULE !== '*') { | ||
exports.log.prefix(BROLOG_MODULE); | ||
if (BROLOG_PREFIX && BROLOG_PREFIX !== '*') { | ||
exports.log.prefix(BROLOG_PREFIX); | ||
} | ||
@@ -391,0 +391,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* Brolog version 1.6.5 */ | ||
/* Brolog version 1.8.1 */ | ||
(function (global, factory) { | ||
@@ -27,3 +27,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
var BROLOG_LEVEL_VAR_NAME = 'BROLOG_LEVEL'; | ||
var BROLOG_MODULE_VAR_NAME = 'BROLOG_MODULE'; | ||
var BROLOG_PREFIX_VAR_NAME = 'BROLOG_PREFIX'; | ||
var level; | ||
@@ -43,3 +43,3 @@ var debugModule; | ||
if (!debugModule) { | ||
debugModule = process.env[BROLOG_MODULE_VAR_NAME]; | ||
debugModule = process.env[BROLOG_PREFIX_VAR_NAME]; | ||
} | ||
@@ -69,3 +69,3 @@ } | ||
var BROLOG_LEVEL = level || DEFAULT_LEVEL; | ||
var BROLOG_MODULE = debugModule || '*'; | ||
var BROLOG_PREFIX = debugModule || '*'; | ||
/*! | ||
@@ -189,3 +189,3 @@ * Brolog JavaScript Library v1.1.0 | ||
if (typeof filter === 'string') { | ||
this.prefixFilter = new RegExp('^' + filter + '$', 'i'); | ||
this.prefixFilter = new RegExp('^' + filter + '$'); | ||
} | ||
@@ -427,4 +427,4 @@ else if (filter instanceof RegExp) { | ||
} | ||
if (BROLOG_MODULE && BROLOG_MODULE !== '*') { | ||
exports.log.prefix(BROLOG_MODULE); | ||
if (BROLOG_PREFIX && BROLOG_PREFIX !== '*') { | ||
exports.log.prefix(BROLOG_PREFIX); | ||
} | ||
@@ -431,0 +431,0 @@ exports.Brolog = Brolog; |
@@ -11,3 +11,3 @@ /*! | ||
*/ | ||
import { VERSION, BROLOG_LEVEL, BROLOG_MODULE, } from './config'; | ||
import { VERSION, BROLOG_LEVEL, BROLOG_PREFIX, } from './config'; | ||
export var LogLevel; | ||
@@ -124,3 +124,3 @@ (function (LogLevel) { | ||
if (typeof filter === 'string') { | ||
this.prefixFilter = new RegExp('^' + filter + '$', 'i'); | ||
this.prefixFilter = new RegExp('^' + filter + '$'); | ||
} | ||
@@ -322,6 +322,6 @@ else if (filter instanceof RegExp) { | ||
} | ||
if (BROLOG_MODULE && BROLOG_MODULE !== '*') { | ||
log.prefix(BROLOG_MODULE); | ||
if (BROLOG_PREFIX && BROLOG_PREFIX !== '*') { | ||
log.prefix(BROLOG_PREFIX); | ||
} | ||
export default Brolog; | ||
//# sourceMappingURL=brolog.js.map |
@@ -212,3 +212,3 @@ #!/usr/bin/env ts-node | ||
t.equal(log2.level(), 'silly', 'should be set level `silly`'); | ||
t.equal(log2.prefix().toString(), '/^faint$/i', 'should be set prefix filter to /faint/i'); | ||
t.equal(log2.prefix().toString(), '/^faint$/', 'should be set prefix filter to /faint/'); | ||
t.end(); | ||
@@ -215,0 +215,0 @@ })); |
declare let VERSION: string; | ||
export { VERSION }; | ||
export declare const BROLOG_LEVEL: string; | ||
export declare const BROLOG_MODULE: string; | ||
export declare const BROLOG_PREFIX: string; |
@@ -21,3 +21,3 @@ /** | ||
const BROLOG_LEVEL_VAR_NAME = 'BROLOG_LEVEL'; | ||
const BROLOG_MODULE_VAR_NAME = 'BROLOG_MODULE'; | ||
const BROLOG_PREFIX_VAR_NAME = 'BROLOG_PREFIX'; | ||
let level; | ||
@@ -37,3 +37,3 @@ let debugModule; | ||
if (!debugModule) { | ||
debugModule = process.env[BROLOG_MODULE_VAR_NAME]; | ||
debugModule = process.env[BROLOG_PREFIX_VAR_NAME]; | ||
} | ||
@@ -63,3 +63,3 @@ } | ||
export const BROLOG_LEVEL = level || DEFAULT_LEVEL; | ||
export const BROLOG_MODULE = debugModule || '*'; | ||
export const BROLOG_PREFIX = debugModule || '*'; | ||
//# sourceMappingURL=config.js.map |
{ | ||
"name": "brolog", | ||
"version": "1.6.5", | ||
"version": "1.8.1", | ||
"description": "Npmlog like logger for Browser", | ||
@@ -54,9 +54,9 @@ "main": "bundles/brolog.umd.js", | ||
"rollup-plugin-json": "^3.0.0", | ||
"rollup": "^0.59.0", | ||
"rollup": "^0.60.0", | ||
"semver": "^5.5.0", | ||
"sinon": "^5.0.3", | ||
"sinon": "^6.0.0", | ||
"sinon-test": "git://github.com/zixia/sinon-test.git#patch-1", | ||
"source-map": "^0.7.2", | ||
"tap": "^12.0.0", | ||
"ts-node": "^6.0.2", | ||
"ts-node": "^7.0.0", | ||
"tslint": "^5.7.0", | ||
@@ -63,0 +63,0 @@ "typescript": "^2.5.2" |
@@ -170,2 +170,15 @@ # BROLOG | ||
### Environment Variable: `BROLOG_PREFIX` | ||
Example: | ||
1. Shell | ||
```sh | ||
BROLOG_PREFIX="(Contact|Puppet)" node wechaty.js | ||
``` | ||
2. This will equals to set by code API: | ||
```ts | ||
log.prefix(/^(Contact|Puppet)$/) | ||
``` | ||
## TEST | ||
@@ -200,4 +213,4 @@ | ||
1. Fix browser broken problem caused by the `rollup` behavior change. ([#69](https://github.com/zixia/brolog/issues/69)) | ||
1. Node.js: Add environment variable `BROLOG_MODULE` to set the `prefix` filter of global `log` instance. | ||
1. Browser: Add URL parameter variable `BROLOG_MODULE` to set the `prefix` filter of global `log` instance. | ||
1. Node.js: Add environment variable `BROLOG_PREFIX` to set the `prefix` filter of global `log` instance. | ||
1. Browser: Add URL parameter variable `BROLOG_PREFIX` to set the `prefix` filter of global `log` instance. | ||
@@ -204,0 +217,0 @@ ### v1.4 (May 2018) |
@@ -257,3 +257,3 @@ #!/usr/bin/env ts-node | ||
t.equal(log2.level(), 'silly', 'should be set level `silly`') | ||
t.equal(log2.prefix().toString(), '/^faint$/i', 'should be set prefix filter to /faint/i') | ||
t.equal(log2.prefix().toString(), '/^faint$/', 'should be set prefix filter to /faint/') | ||
@@ -260,0 +260,0 @@ t.end() |
@@ -14,3 +14,3 @@ /*! | ||
BROLOG_LEVEL, | ||
BROLOG_MODULE, | ||
BROLOG_PREFIX, | ||
} from './config' | ||
@@ -178,3 +178,3 @@ | ||
if (typeof filter === 'string') { | ||
this.prefixFilter = new RegExp('^' + filter + '$', 'i') | ||
this.prefixFilter = new RegExp('^' + filter + '$') | ||
} else if (filter instanceof RegExp) { | ||
@@ -398,6 +398,6 @@ this.prefixFilter = filter | ||
if (BROLOG_MODULE && BROLOG_MODULE !== '*') { | ||
log.prefix(BROLOG_MODULE) | ||
if (BROLOG_PREFIX && BROLOG_PREFIX !== '*') { | ||
log.prefix(BROLOG_PREFIX) | ||
} | ||
export default Brolog |
@@ -28,3 +28,3 @@ /** | ||
const BROLOG_LEVEL_VAR_NAME = 'BROLOG_LEVEL' | ||
const BROLOG_MODULE_VAR_NAME = 'BROLOG_MODULE' | ||
const BROLOG_PREFIX_VAR_NAME = 'BROLOG_PREFIX' | ||
@@ -47,3 +47,3 @@ let level : undefined | string | ||
if (!debugModule) { | ||
debugModule = process.env[BROLOG_MODULE_VAR_NAME] | ||
debugModule = process.env[BROLOG_PREFIX_VAR_NAME] | ||
} | ||
@@ -76,2 +76,2 @@ } | ||
export const BROLOG_LEVEL = level || DEFAULT_LEVEL | ||
export const BROLOG_MODULE = debugModule || '*' | ||
export const BROLOG_PREFIX = debugModule || '*' |
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 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
143768
281