drewww/unhangout — pull request #221 by yourcelf (2013-11-09 20:39:24+00:00)
Title: Email error logging; transports set with NODE_ENV

Refactor the loging configuration into a single file, ``lib/logging.js``, which can be required by any module that wants the standard logging configuration. This eliminates the need for ``unhangout-server`` to hold a public reference to the logger and assign it to other components, and removes the many invocations of winston.

Eliminate the logging transport and level options sent to unhangout-server's ``init``. Instead, use the NODE_ENV environment variable to determine transport and level options. Use the following NODE_ENV conventions:

- NODE_ENV=production : log to file at level INFO, and send emails on error.
- NODE_ENV=testing : log at level CRIT to console.
- else: log at level DEBUG to console.

``npm test`` now invokes ``NODE_ENV=testing mocha``; invoking mocha directly without setting the ``NODE_ENV`` will result in default console logging during tests. In production, the NODE_ENV=production
environment var must be set to configure logging properly.