Repository navigation
Add componentConsole registry option - #1465
leandrowilliam wants to merge 1 commit into
Conversation
e965fe4 to
13ed32f
Compare
|
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 |
|
@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 |
|
@ricardo-devis-agullo Hi, do you have any updates on this one? Thanks |
196b8b1 to
0335c9b
Compare
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
0335c9b to
7789e3e
Compare
|
@ricardo-devis-agullo I updated this PR, can we get it merged? |
Closes
Closes #1464
Overview
Components' server-side
consoleis currently only wired to the real console whenlocalis 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
componentConsoleregistry option. The registry passes it into the component sandbox, so you can provideconsoleor a console-like object that forwards logs to a monitoring provider.Defaults are unchanged: if
componentConsoleisn't set, components get the real console whenlocalis true and a no-op console otherwise.packages/oc/src/types.ts: new optionalcomponentConsole?: Partial<Console>onConfigpackages/oc/src/registry/routes/helpers/get-component.ts:conf.componentConsole ?? (conf.local ? console : noopConsole)Rebased onto the current monorepo layout, replacing the earlier version of this PR.
cc: @kmcrawford @GinGatt