brianc / node-pg-pool

A connection pool for node-postgres
MIT License
180 stars 64 forks source link

this.log is not a function #93

Open mike-aungsan opened 6 years ago

mike-aungsan commented 6 years ago

Where is log function? Where is this.log come from?

at Pool.connect (/var/storage/pss/node_modules/pg-pool/index.js:189:10)

189: this.log('connecting new client')

const client = new this.Client(this.options) this._clients.push(client) const idleListener = (err) => { err.client = client client.removeListener('error', idleListener) client.on('error', () => { this.log('additional client error after disconnection due to error', err) }) this._remove(client) // TODO - document that once the pool emits an error // the client has already been closed & purged and is unusable this.emit('error', err, client) }

this.log('connecting new client')

// connection timeout logic
let tid
let timeoutHit = false
if (this.options.connectionTimeoutMillis) {
  tid = setTimeout(() => {
    this.log('ending client due to timeout')
    timeoutHit = true
    // force kill the node driver, and let libpq do its teardown
    client.connection ? client.connection.stream.destroy() : client.end()
  }, this.options.connectionTimeoutMillis)
}
charmander commented 6 years ago

Please show the script you’re running, not pg-pool’s source. log is set here: https://github.com/brianc/node-pg-pool/blob/4d7734a71122cbbe1bb81bb466430e96f3405394/index.js#L67