packages/mongo/lib/utils.js
function logConnectionEvents (conn) {
  // Emitted after getting disconnected from the db.
  // _readyState: 0
  conn.on('disconnected', () => {
    conn.$logger.debug('Disconnected!')
  })

  // Emitted when this connection successfully connects to the db.
  // May be emitted multiple times in reconnected scenarios.
  // _readyState: 1
  conn.on('connected', () => {
    conn.$logger.success('Connected!')
  })

  // Emitted when connection.{open,openSet}() is executed on this connection.
  // _readyState: 2
  conn.on('connecting', () => {
    conn.$logger.info('Connecting...')
  })

  // Emitted when connection.close() was executed.
  // _readyState: 3
  conn.on('disconnecting', () => {
    conn.$logger.debug('Disconnecting...')
  })

  // Emitted when an error occurs on this connection.
  conn.on('error', (error) => {
    conn.$logger.error(error)
  })

  // Emitted after we connected and onOpen is executed
  // on all of this connections models.
  conn.on('open', () => {
    conn.$logger.debug('Connection opened!')
  })

  // Emitted after we connected and subsequently disconnected,
  // followed by successfully another successfull connection.
  conn.on('reconnected', () => {
    conn.$logger.debug('Reconnected!')
  })

  // Emitted in a replica-set scenario, when all nodes specified
  // in the connection string are connected.
  conn.on('fullsetup', () => {
    conn.$logger.debug('ReplicaSet ready!')
  })
}
function logConnectionEvents (conn) {
  // Emitted after getting disconnected from the db.
  // _readyState: 0
  conn.on('disconnected', () => {
    conn.$logger.debug('Disconnected!')
  })

  // Emitted when this connection successfully connects to the db.
  // May be emitted multiple times in reconnected scenarios.
  // _readyState: 1
  conn.on('connected', () => {
    conn.$logger.success('Connected!')
  })

  // Emitted when connection.{open,openSet}() is executed on this connection.
  // _readyState: 2
  conn.on('connecting', () => {
    conn.$logger.info('Connecting...')
  })

  // Emitted when connection.close() was executed.
  // _readyState: 3
  conn.on('disconnecting', () => {
    conn.$logger.debug('Disconnecting...')
  })

  // Emitted when an error occurs on this connection.
  conn.on('error', (error) => {
    conn.$logger.error(error)
  })

  // Emitted after we connected and onOpen is executed
  // on all of this connections models.
  conn.on('open', () => {
    conn.$logger.debug('Connection opened!')
  })

  // Emitted after we connected and subsequently disconnected,
  // followed by successfully another successfull connection.
  conn.on('reconnected', () => {
    conn.$logger.debug('Reconnected!')
  })

  // Emitted in a replica-set scenario, when all nodes specified
  // in the connection string are connected.
  conn.on('fullsetup', () => {
    conn.$logger.debug('ReplicaSet ready!')
  })
}
function logConnectionEvents ( conn ) { // Emitted after getting disconnected from the db. // _readyState: 0 conn . on ( 'disconnected' , ( ) => { conn . $logger . debug ( 'Disconnected!' ) } ) // Emitted when this connection successfully connects to the db. // May be emitted multiple times in reconnected scenarios. // _readyState: 1 conn . on ( 'connected' , ( ) => { conn . $logger . success ( 'Connected!' ) } ) // Emitted when connection.{open,openSet}() is executed on this connection. // _readyState: 2 conn . on ( 'connecting' , ( ) => { conn . $logger . info ( 'Connecting...' ) } ) // Emitted when connection.close() was executed. // _readyState: 3 conn . on ( 'disconnecting' , ( ) => { conn . $logger . debug ( 'Disconnecting...' ) } ) // Emitted when an error occurs on this connection. conn . on ( 'error' , ( error ) => { conn . $logger . error ( error ) } ) // Emitted after we connected and onOpen is executed // on all of this connections models. conn . on ( 'open' , ( ) => { conn . $logger . debug ( 'Connection opened!' ) } ) // Emitted after we connected and subsequently disconnected, // followed by successfully another successfull connection. conn . on ( 'reconnected' , ( ) => { conn . $logger . debug ( 'Reconnected!' ) } ) // Emitted in a replica-set scenario, when all nodes specified // in the connection string are connected. conn . on ( 'fullsetup' , ( ) => { conn . $logger . debug ( 'ReplicaSet ready!' ) } ) }
Utiliy function to setup logger on db
Utiliy function to setup logger on db