How to log errors in mongoose, but unit testable?

I would like to log errors in my data access layer which uses mongoose.

How do I make it easy to unit test? What is the best way to integrate mongoose(data access + middleware) with winston(logger).

Thank you,

Pavel

Here is how I integrated mongoose with winston.

// Create the mongoose instance
var mongoose = require('mongoose');
mongoose.connect(...); // etc.

// Create the winston logger
var winston = require('winston')
  , logger = new (winston.Logger)({
      transports: new (winston.transports.Console)({
        uncaughtException: true,
        level: 'debug',
        colorize: 'true'
      }),
    });

// Configure mongoose for debug
mongoose.set('debug', function (collectionName, method, query, doc, options) {
  logger.info('mongo collection: %s method: %s', collectionName, method);
});