Skip to content

Instantly share code, notes, and snippets.

@dsasse07
Created March 8, 2021 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsasse07/14cbba001863c8685f8d81a1a6703975 to your computer and use it in GitHub Desktop.
Save dsasse07/14cbba001863c8685f8d81a1a6703975 to your computer and use it in GitHub Desktop.
Log message generator class
export class Log {
static error(msg){
let date = new Date();
let time = date.toLocaleTimeString();
return {type: 'error', msg: `[${time}] ERROR: ${msg}`}
}
static warn(msg){
let date = new Date();
let time = date.toLocaleTimeString();
return {type: 'warn', msg: `[${time}] WARN: ${msg}`}
}
static notify(msg){
let date = new Date();
let time = date.toLocaleTimeString();
return {type: 'notify', msg: `[${time}] NOTIFY: ${msg}`}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment