gogm icon indicating copy to clipboard operation
gogm copied to clipboard

log query

Open jcchen2 opened this issue 2 years ago • 2 comments

Committer Notes

log cypher query and parameters at debug level

Checklist

  • [x] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have included new tests that address the changes

jcchen2 avatar Mar 05 '22 06:03 jcchen2

Hello @jcchen2, thanks for your contributions! I think this is looking good! However I do have a few comments:

  • if possible I think query logging and ESPECIALLY parameter logging should be toggleable via a setting in the gogm config (that should probably default to off). Parameter logging can lead to nasty vulnerabilities if someone gets access to your logs.
  • instead of logging the cypher parameters at each point, injecting that functionality into a session's runReadOnly and runWrite methods would be a bit more elegant and future proof. @erictg any ideas on how to extract the cypher parameters from the runWrite method?

nikitawootten avatar Mar 10 '22 00:03 nikitawootten

@nikitawootten i created logging wrappers around neo4j's session and transaction. it should be future-proof. i also updated logging to conditionally log parameters. pls let me know what you think.

jcchen2 avatar Mar 12 '22 19:03 jcchen2