How to I log debug output to the dev console?


I want to port a sublime text package (‘Writing Style’ on Package Control) to Atom. I’m new to Coffeescript and the Atom API. How can I log output to the dev console so I can see when my code is running and what it is doing?

Thanks for developing a great editor!

Unable to use console.log

console.log ‘YOUR MESSAGE’


Is there any way to log during activation? This doesn’t print anything for me:

module.exports =
  activate: ->
    console.log "hello"


That should work. Are you sure you’re package is actually being activated?


No… that’s why I was trying to log to the console :stuck_out_tongue: How can I make it be activated? Do I have to call one of the functions specified in activationEvents in order to get the plugin to start working?


I can think of a couple things that might be wrong…

First of all, are you reloading the extension after making changes? Do cmd-alt-ctrl-L to totally refresh the page.

Where is your package stored? If it’s in ~/.atom/packages/your-package. then that shouldn’t be a problem. If it’s in ~/.atom/dev/packages/your-package/ then make sure you opened Atom in dev mode. If it’s anywhere else then move it an try loading it again.

Is your package.json referring to the right entrypoint file? If your script is in your-package/lib/ then your main value in package.json should be something like './lib/'.

Are there any errors in the console? (I’m assuming you do have the console open but if not do cmd-alt-i)