Thursday, 2 March 2017

LPT: use Atom snippets to automatically put time stamps in console.log output (x-post from /r/javascript)

Sadly I just figured out this dandy little feature.Atom -> Snippets -> insert the following:'.source.js': 'console.log': 'prefix': 'log' 'body': 'console.log(moment().format(\'YYYY-MM-DD HH:mm:ss.SS - \') + \'$1\');' now when you type in 'log' and hit tab, your properly formatted date will appear in the console.log and your cursor will be in the second single quote area to start typing.edit: if you dont have moment installed just use the standard javascript date.'.source.js': 'console.log': 'prefix': 'log' 'body': 'console.log(new Date() + ' - ' + \'$1\');'

Submitted March 02, 2017 at 06:22PM by dangerzone2

No comments:

Post a Comment