-
Notifications
You must be signed in to change notification settings - Fork 2
LogBar
Pair\Helpers\LogBar is Pair’s local request inspector for events, SQL queries, warnings, errors, and request timing.
getInstance(): LogBarevent(string $description, string $type = 'notice', ?string $subtext = null): voidrender(): stringcanBeShown(): booldisable(): void
Useful counters:
getErrorCount(): intgetWarningCount(): intgetQueryCount(): int
The legacy event API remains supported:
\Pair\Helpers\LogBar::event('Import started', 'notice');The database layer uses a structured query event internally so SQL can be grouped safely by fingerprint.
The rendered LogBar includes:
- Overview diagnostics for slow requests, DB-bound requests, high query counts, duplicate query fingerprints, slow queries, warnings/errors, and memory pressure
- Timeline waterfall based on request-relative event start and duration
- Queries view grouped by normalized SQL fingerprint
- Events view with the chronological event list
- Vanilla-JS search and filters for text, event type, queries, warnings/errors, and duplicate query groups
The header separates runtime context from performance metrics. The title area shows route/action when available, application environment, active UI framework, the current Bootstrap or Bulma breakpoint when one of those UI frameworks is selected, and a copyable Pair observability correlation ID. The metric row shows total request time, DB time and percentage, query count, peak memory, and warning/error counts.
LogBar is a local debug tool, not a production data export channel.
By default, SQL query previews are normalized and do not render bound values:
SELECT * FROM sessions WHERE id = ? LIMIT ?Set PAIR_LOGBAR_SHOW_SQL_VALUES=true only for a controlled local debugging session. Even with that opt-in enabled, values are masked when parameter names or nearby column names suggest sensitive data such as tokens, secrets, passwords, authorization headers, cookies, sessions, SIDs, emails, keys, or hashes.
Pair does not add raw SQL parameters to db.query observability spans.
Defaults:
PAIR_LOGBAR_SLOW_REQUEST_MS=250PAIR_LOGBAR_SLOW_QUERY_MS=20PAIR_LOGBAR_QUERY_BUDGET=30PAIR_LOGBAR_DUPLICATE_QUERY_BUDGET=3PAIR_LOGBAR_MAX_EVENTS=500PAIR_LOGBAR_SHOW_SQL_VALUES=false
Track slow operation:
\Pair\Helpers\LogBar::event('External API call', 'api', 'provider-x');Render in template/layout:
echo \Pair\Helpers\LogBar::getInstance()->render();- DB layer automatically writes safe query events to LogBar.
- Visibility depends on user permissions and options.
- AJAX LogBar output remains a compact event list for compatibility and follows the same SQL value hiding defaults.
See also: Database, Logger, Application, Observability, Configuration-file.