File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
12
12
ILogger ,
13
13
IPicGo
14
14
} from '../types'
15
- import { forceNumber } from '../utils/common'
15
+ import { forceNumber , isDev } from '../utils/common'
16
16
17
17
export class Logger implements ILogger {
18
18
private readonly level = {
@@ -130,6 +130,12 @@ export class Logger implements ILogger {
130
130
warn ( ...msg : ILogArgvType [ ] ) : void {
131
131
return this . handleLog ( ILogType . warn , ...msg )
132
132
}
133
+
134
+ debug ( ...msg : ILogArgvType [ ] ) : void {
135
+ if ( isDev ( ) ) {
136
+ this . handleLog ( ILogType . info , ...msg )
137
+ }
138
+ }
133
139
}
134
140
135
141
export default Logger
Original file line number Diff line number Diff line change @@ -367,3 +367,11 @@ export function safeParse<T> (str: string): T | string {
367
367
export const forceNumber = ( num : string | number = 0 ) : number => {
368
368
return isNaN ( Number ( num ) ) ? 0 : Number ( num )
369
369
}
370
+
371
+ export const isDev = ( ) : boolean => {
372
+ return process . env . NODE_ENV === 'development'
373
+ }
374
+
375
+ export const isProd = ( ) : boolean => {
376
+ return process . env . NODE_ENV === 'production'
377
+ }
You can’t perform that action at this time.
0 commit comments