Skip to content

Add componentConsole registry option - #1465

Open
leandrowilliam wants to merge 1 commit into
opencomponents:masterfrom
leandrowilliam:issues/1464-logger-param
Open

leandrowilliam wants to merge 1 commit into
opencomponents:masterfrom
leandrowilliam:issues/1464-logger-param

Conversation

@leandrowilliam

@leandrowilliam leandrowilliam commented Jan 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes

Closes #1464

Overview

Components' server-side console is currently only wired to the real console when local is true (i.e. oc dev). In deployed registries there's no way to see component logs.

Solution

Following @ricardo-devis-agullo's suggestion, add an optional componentConsole registry option. The registry passes it into the component sandbox, so you can provide console or a console-like object that forwards logs to a monitoring provider.

oc.Registry({
  // ...
  componentConsole: myMonitoringConsole
});

Defaults are unchanged: if componentConsole isn't set, components get the real console when local is true and a no-op console otherwise.

  • packages/oc/src/types.ts: new optional componentConsole?: Partial<Console> on Config
  • packages/oc/src/registry/routes/helpers/get-component.ts: conf.componentConsole ?? (conf.local ? console : noopConsole)
  • Unit test + changeset (minor)

Rebased onto the current monorepo layout, replacing the earlier version of this PR.

cc: @kmcrawford @GinGatt

@leandrowilliam
leandrowilliam force-pushed the issues/1464-logger-param branch from e965fe4 to 13ed32f Compare January 7, 2026 21:09
@ricardo-devis-agullo

ricardo-devis-agullo commented Jan 14, 2026 •

Copy link
Copy Markdown
Collaborator

Hi, the distinction here is not local filesystem or remote storage, but local development or production. I don't think it's a great idea to let all components log on the registry without control. Even if we were I don't think enableComponentConsoleOutput is a great name, and even in that case, if we are going to give a pass to let components log, it might be better to let the the registry provide a console interface ({ componentConsole: console }), so perhaps you could pass a console interface that sends logs to a monitoring provider instead

@leandrowilliam

Copy link
Copy Markdown
Contributor Author

Hi, the distinction here is not local filesystem or remote storage, but local development or production. I don't think it's a great idea to let all components log on the registry without control. Even if we were I don't think enableComponentConsoleOutput is a great name, and even in that case, if we are going to give a pass to let components log, it might be better to let the the registry provide a console interface ({ componentConsole: console }), so perhaps you could pass a console interface that sends logs to a monitoring provider instead

Got it, thanks for the clarification. I agree with that direction. I’ll update the approach and push the changes shortly

@leandrowilliam
leandrowilliam marked this pull request as draft January 14, 2026 13:55
@leandrowilliam
leandrowilliam marked this pull request as ready for review January 14, 2026 14:50
@leandrowilliam

leandrowilliam commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@ricardo-devis-agullo Let me know if that works for you or if you think we should adjust anything else. Thanks

Update: I also left a note in the issue

@leandrowilliam leandrowilliam changed the title Add enableComponentConsoleOutput config to decouple logging from storage location Add componentConsole config to decouple logging from storage location Jan 14, 2026
@leandrowilliam

Copy link
Copy Markdown
Contributor Author

@ricardo-devis-agullo Hi, do you have any updates on this one? Thanks

@leandrowilliam
leandrowilliam force-pushed the issues/1464-logger-param branch from 196b8b1 to 0335c9b Compare October 19, 2026 19:00
@leandrowilliam leandrowilliam changed the title Add componentConsole config to decouple logging from storage location Add componentConsole registry option Oct 19, 2026
Lets the registry expose a console (or a console-like logger that forwards
to a monitoring provider) to components' server-side code outside of
`oc dev`. Defaults are unchanged: real console when local, no-op otherwise.

Closes opencomponents#1464
@leandrowilliam

Copy link
Copy Markdown
Contributor Author

@ricardo-devis-agullo I updated this PR, can we get it merged?

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.

Component console output is not visible when registry uses remote storage

2 participants