0

I need help with logging functions in PhantomJS. I want to render canvas images on the server side with PhantomJS. This part runs very well, but I can't figure out how to setup a good logging function in Phantom.

I want to separete logs due to their level in separtet files.

logger.log('info', 'Test Info Message'); // -> info.log
logger.log('error', 'Log Exception'); // -> error.log

Is there another way as piping the process output to some file?

I would like to use some NodeJS logging framework as winston directly in the PhantomJS because with winston I could use log ratation out of the box.

Thx for your help :)

Modern Labs
  • 1,027
  • 8
  • 6

1 Answers1

0

Winston uses node.js' file streams from the fs module. PhantomJS also has a fs module, but it has a completely different API. That's why you can't use Winston for that directly. You could potentially rewrite Winston so that it runs in PhantomJS.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222