Skip to content

Instantly share code, notes, and snippets.

@ArielLeslie
Created November 19, 2021 19:34
Show Gist options
  • Save ArielLeslie/1158010a758d39b99412ed00a0c384a2 to your computer and use it in GitHub Desktop.
Save ArielLeslie/1158010a758d39b99412ed00a0c384a2 to your computer and use it in GitHub Desktop.
Fancy print console logs to the terminal (VSCode snippets)
{
"Print with labels": {
"scope": "javascript,typescript,javascriptreact,typescriptreact",
"prefix": "console-log-labeled",
"body": [
"// TODO: Don't forget to delete this",
"console.log('\\x1b[35m\\x1b[1m\\x1b[42m%s\\x1b[0m', '################## ${1:LABEL} ##################');",
"console.log($2);",
"console.log('\\x1b[35m\\x1b[1m\\x1b[42m%s\\x1b[0m', '################ END $1 ################');",
],
"description": "log to terminal with colorful labels"
},
"Print with error-labels": {
"scope": "javascript,typescript,tsx,javascriptreact,typescriptreact",
"prefix": "console-error-labeled",
"body": [
"// TODO: Don't forget to delete this",
"console.log('\\x1b[41m\\x1b[1m%s\\x1b[0m', '################### ERROR ###################');",
"console.error($1);",
"console.log('\\x1b[41m\\x1b[1m%s\\x1b[0m', '#############################################');",
],
"description": "error to terminal with colorful labels"
},
"Print with warning-labels": {
"scope": "javascript,typescript,tsx,javascriptreact,typescriptreact",
"prefix": "console-warn-labeled",
"body": [
"// TODO: Don't forget to delete this",
"console.log('\\x1b[43m\\x1b[1m\\x1b[30m%s\\x1b[0m', '################## WARNING ##################');",
"console.warn($1);",
"console.log('\\x1b[43m\\x1b[1m\\x1b[30m%s\\x1b[0m', '#############################################');",
],
"description": "error to terminal with colorful labels"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment