loopbackio / loopback-connector-postgresql

PostgreSQL connector for LoopBack.
Other
117 stars 180 forks source link

Allow to debug queries only, not data #241

Closed ellenaua closed 7 years ago

ellenaua commented 7 years ago

To debug queries executed in Loopback, I've set DEBUG environment variable to loopback:connector:postgresql.
Now, loopback-connector-postgresql is printing to console both queries and data returned from Postgres. It would be great to see only queries! It'll be possible if inside loopback-connector-postgresql you'll use debug() with 2 scopes - loopback:connector:postgresql:queries and loopback:connector:postgresql:data

raymondfeng commented 7 years ago

@ellenaua Can you submit a patch to provide fine-grained debug control with 2 or more scopes as you proposed?

ellenaua commented 7 years ago

I added this pull request https://github.com/strongloop/loopback-connector-postgresql/pull/242 I tried to change as little as possible.

But in general, debugging there is made in two ways: 1) in some places debug() is called 2) in some places self.debug() is called

Seems, self.debug can be removed and replaced by debug() calls - self.debug was used when debugging was made using console.log()

Also, check for if (self.settings.debug) is made outside self.debug() calls and inside self.debug() function.

ellenaua commented 7 years ago

This, another, pull request - https://github.com/strongloop/loopback-connector-postgresql/pull/243 - has more changes as I removed self.debug and replaced it by debug() calls You can merge either PR #242 or PR #243 to fix this issue

ssh24 commented 7 years ago

Fixed with https://github.com/strongloop/loopback-connector-postgresql/pull/275.