Skip to content

Dumps viewer never displays log context #223

Description

@wadimsewo

Summary

The Logs tab in the Dumps window shows the log level and message, but never the
context array Laravel attaches to Log::info()/Log::error()/etc. calls, even when
the daemon is receiving non-empty context in the event payload.

Where

apps/yerd-gui/src/views/DumpsWindowView.vue, rowBody():

case "log":
  return `${str(p.level)} ${str(p.message)}`.trim();

p.context is never read. The docs already promise this (docs/guide/laravel-dumps.md):

Logs | Log writes, with level and context

Fix

Append p.context (pretty-printed) to the row body when it's a non-empty object:

case "log": {
  const head = `${str(p.level)} ${str(p.message)}`.trim();
  const ctx = p.context;
  const hasCtx = ctx !== undefined && ctx !== null && !(typeof ctx === "object" && Object.keys(ctx).length === 0);
  return hasCtx ? `${head}\n${JSON.stringify(ctx, null, 2)}` : head;
}

Related

While testing this against a real app, found a second, upstream bug: the yerd-dump
extension itself sends an empty context: {} whenever any context value isn't
string-coercible (e.g. a nested array), dropping the whole context rather than just
that key. Filed separately: forjedio/yerd-php-ext#3. Both need fixing for context to
show up end-to-end for typical Laravel log calls.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions