File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 1- const log = ( ... args : any ) => console . log ( `LOG: ${ Date . now ( ) } ` , ... args ) ;
2- const info = ( ... args : any ) => console . info ( `INF :${ Date . now ( ) } `, ...args ) ;
3- const error = ( ... args : any ) => console . error ( `ERR: ${ Date . now ( ) } ` , ... args ) ;
1+ const doLog = ( fn : Function , prefix : string , args : any ) => {
2+ fn ( ` ${ prefix } :${ Date . now ( ) } `, ...args ) ;
3+ } ;
44
5- export { log , info , error } ;
6- export default { log, info, error } ;
5+ const log = ( ...args : any ) => doLog ( console . log , 'LOG' , args ) ;
6+ const info = ( ...args : any ) => doLog ( console . info , 'INF' , args ) ;
7+ const warn = ( ...args : any ) => doLog ( console . warn , 'WRN' , args ) ;
8+ const error = ( ...args : any ) => doLog ( console . error , 'ERR' , args ) ;
9+
10+ export { log , info , warn , error } ;
11+ export default { log, info, warn, error } ;
You can’t perform that action at this time.
0 commit comments