vadimpronin / guacamole-lite

Node.js library for creating Guacamole-compatible servers. Guacamole is a RDP/VNC/SSH/Telnet client for HTML5 browsers.
Apache License 2.0
250 stars 78 forks source link

Logs in production #15

Closed NAlexandrov closed 6 years ago

NAlexandrov commented 6 years ago

Can you disable log when NODE_ENV=production? Or console.log can be replaced to debug module?

Thank you.

hehex9 commented 6 years ago

Currently, maybe we can use log: { verbose: false } in clientOptions when NODE_ENV=production or just log: { verbose: process.env.NODE_ENV !== 'production' }, which is not mentioned in the doc.

vadimpronin commented 6 years ago

Sorry for long delay, I've been on vacation and could not make an appropriate fix. In 0.6.2 I've added 5 log levels: QUIET - basically no logs ERRORS - only errors NORMAL - only "server started" and "server stopped" messages VERBOSE - (default) corresponds to what was previously non-verbose log. I.e. all the connection messages, guacd handshake and probably a few more. DEBUG - corresponds to what previously was verbose: true i.e. prints all the guac protocol exchange between client and guacd

Also now you can redefine standard logging functions. By default guacamole-lite using console.log and console.error functions for logging, but you can write your own functions (for example if you want to redirect log elsewhere) and pass them through log: { stdLog: yourStdLogFunc, errorLog: yourErrorLogFunc}

I've added corresponding sections to README