Skip to content

Allow componentConsole to be a function - #1584

Open
leandrowilliam wants to merge 2 commits into
opencomponents:masterfrom
leandrowilliam:issues/1583-component-console-fn
Open

leandrowilliam wants to merge 2 commits into
opencomponents:masterfrom
leandrowilliam:issues/1583-component-console-fn

Conversation

@leandrowilliam

@leandrowilliam leandrowilliam commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1583

Builds on #1465

componentConsole can now also be a function. The registry calls it with the component's name and version and uses the console it returns, so logs can be tagged per component:

componentConsole: ({ name, version }) => createLogger({ component: name, version })

Passing a plain console object works as before. The function is only called when the component's server code is loaded, not on every request.

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
Lets the registry return a console per component, so logs can be tagged
with the component name and version.

Closes opencomponents#1583
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.

Let componentConsole know which component is logging

1 participant