Skip to content

TL_LOG_QUERIES#7

Closed
irees wants to merge 2 commits into
mainfrom
log-gate
Closed

TL_LOG_QUERIES#7
irees wants to merge 2 commits into
mainfrom
log-gate

Conversation

@irees

@irees irees commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in gate for per-query database logging. Previously, enabling TRACE-level logging would emit one line per query, flooding output. This introduces a separate TL_LOG_QUERIES switch so query logging can be turned on independently and stays off by default.

Changes

  • New package-level queryLogging flag, initialized from TL_LOG_QUERIES=true (off by default)
  • LogQueries() bool — reports whether per-query logging is enabled
  • SetLogQueries(bool) — toggles it at runtime

Notes

Callers that emit per-query logs should gate them on log.LogQueries(). Default behavior is unchanged — query logging stays silent unless explicitly enabled via the env var or SetLogQueries.

Copilot AI review requested due to automatic review settings June 9, 2026 07:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a package-level toggle for per-query database logging, gated by a new TL_LOG_QUERIES environment variable, to avoid flooding logs when TRACE logging is enabled.

Changes:

  • Introduces TL_LOG_QUERIES env var gating via a new queryLogging flag.
  • Adds LogQueries() getter and SetLogQueries(bool) setter for controlling query logging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread log.go
Comment on lines +58 to +61
// SetLogQueries enables or disables per-query database logging at runtime.
func SetLogQueries(v bool) {
queryLogging = v
}
@irees

irees commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Just did this directly in transitland-lib since that's where querylogger lives

@irees irees closed this Jun 9, 2026
@irees irees deleted the log-gate branch June 9, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants