Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

this.log is not a function #93

Open
mike-aungsan opened this issue Jan 9, 2018 · 1 comment
Open

this.log is not a function #93

mike-aungsan opened this issue Jan 9, 2018 · 1 comment

Comments

@mike-aungsan
Copy link

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
Copy link
Collaborator

Please show the script you’re running, not pg-pool’s source. log is set here:

this.log = this.options.log || function () { }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants