Skip to content

Commit 0f31300

Browse files
authored
fix: Verbose mode is enabled if environment variables VERBOSE or VERBOSE_PARSE_SERVER_PUSH_ADAPTER are set to any value (#264)
1 parent 032cd76 commit 0f31300

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
// PushAdapter, it uses GCM for android push, APNS for ios push.
44
// WEB for web push.
55
import log from 'npmlog';
6+
import { booleanParser } from './utils.js';
67

7-
/* istanbul ignore if */
8-
if (process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER_PUSH_ADAPTER) {
8+
/* c8 ignore start */
9+
if (booleanParser(process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER_PUSH_ADAPTER)) {
910
log.level = 'verbose';
1011
}
12+
/* c8 ignore stop */
1113

1214
import ParsePushAdapter from './ParsePushAdapter.js';
1315
import GCM from './GCM.js';

src/utils.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function booleanParser(opt) {
2+
if (opt == true || opt == 'true' || opt == '1') {
3+
return true;
4+
}
5+
return false;
6+
}
7+
8+
export {
9+
booleanParser,
10+
}

0 commit comments

Comments
 (0)