Closed pleerock closed 3 weeks ago
Hey, I'm not very familiar with how Pino works in a browser. Do you think exporting LogPusher would be enough? Have you been able to test it? If so, no worries, I can export that quickly.
A potential issue is this import in the LogPusher file: https://github.com/Julien-R44/pino-loki/blob/dev/src/log_pusher.ts#L1, which itself imports node:util
. So it will not work in the browser. You'll need to tweak your bundling with browserify or something else (but it seems already mandatory when using Pino according to their documentation) ?
@Julien-R44 yeah I ended up with my own transport implementation (actually I decided to send logs the mediator server, before they reach Loki).
Exporting LogPusher
might help, but nodejs dependencies also should be avoided.
Feel free to close this issue, or leave it open in case if you plan to add browser support.
Thank you for your quick answer.
Great work on loki transport, and I was about asking browser support.
Pino has a different architecture for browser environment and I don't think connecting transports work in the browser.
However we can simply "call" the functions we need in the "browser.write" API of Pino.
Now, in order to make pino-loki to work in the browser, I just need to have methods exposed from your library. Can you assist to make pino-loki to work in the browser?
Example:
It looks like I need to use
LogPusher
somehow, but it also needs to be exported from the module.