Task :
So, I'd rather not type
consoleeach time I want to use it.
I want to import some shorthand, eg--log('hi')same asconsole.log('hi')
Tried Case :
- Here is my work so far.
I'd like to use shorthand oflog, warn, error, infoto corresponding console functions. - I hope this doesn't seem totally bad practice, but I'm willing to listen.
Problem :
- I'm puzzled how to export and import these in order to use the desired notation.
Open to all suggestions.
Please suggest.
Thank you.
log = (arg, ...argv) => console.log(arg, ...argv)
err = (arg, ...argv) => console.error(arg, ...argv)
error = (arg, ...argv) => console.error(arg, ...argv)
info = (arg, ...argv) => console.info(arg, ...argv)
warn = (arg, ...argv) => console.warn(arg, ...argv)
// how to export? should this be a class?
let { log, err, info, warn } = consoleerrnot belongs to console, am i correct?err: )