Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 582601b

Browse files
committed
fix: allow globals to be set without major version
1 parent 64191f3 commit 582601b

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/config.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,16 @@ const Action = actionType === 'spinner' ? require('./action/spinner').default :
2727
export class Config {
2828
logLevel: Levels = 'warn'
2929
outputLevel: Levels = 'info'
30-
_debug = false
3130
action: ActionBase = new Action()
3231
errorsHandled = false
33-
context: any = {}
34-
errlog?: string
3532
showStackTrace = true
3633

37-
constructor() {
38-
this.debug = process.env.DEBUG === '*'
39-
}
40-
41-
get debug(): boolean {
42-
return this._debug
43-
}
44-
set debug(v: boolean) {
45-
this._debug = v
46-
if (this._debug && this.outputLevel !== 'trace') this.outputLevel = 'debug'
47-
}
34+
get debug(): boolean { return globals.debug || process.env.DEBUG === '*' }
35+
set debug(v: boolean) { globals.debug = v }
36+
get context(): any { return globals.context || {} }
37+
set context(v: any) { globals.context = v }
38+
get errlog(): string | undefined { return globals.errlog || {} }
39+
set errlog(v: string | undefined) { globals.errlog = v }
4840
}
4941

5042
function fetch() {

0 commit comments

Comments
 (0)