-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using pino/browser for Cloudflare Workers #2035
Comments
Note I'm now doing this: #1969 (comment) But above questions are still relevant. |
We are not testing against Cloudflare Workers, so this is essentially unsupported right now on that platform. |
Seconding that this is not specific to Cloudflare Workers, the EDIT: Code Sandbox link to demonstrate, little clunky to find the JS console: |
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
If I find the time soon, I sure will! Thanks 😄 |
It looks like Codesandbox: https://codesandbox.io/p/sandbox/elastic-haze-997gtz |
Hi,
I'm trying to use pino (browser) with Cloudflare Workers.
This is my config do far:
which outputs the log messages like below and is a good start:
logger.debug('Loading customer with id=%s', 'jane-doe')
:logger.trace('Fetching customer with id=%s from database', 'jane-doe')
:(1)
Although the
level
is defined astrace
, calls tologger.trace(..)
are not being logged... is that expected behaviour with pino/browser?Now when I add the custom
write
option to the config, trace is being outputted...logger.debug('Loading customer with id=%s', 'jane-doe')
:logger.trace('Fetching customer with id=%s from database', 'jane-doe')
:so with a custom
write
option it seems to pick uptrace
logs...(2)
When creating the logger I used the following
base
option to set a context requestId...but this is never logged, nor available in the
write: (o)
object... is it possible to use a context with pino/browser?Note I also looked into logMethod but that does not seem to be invoked by pino/browser at all.
Now when I create a child logger and pass the
requestId
it does work:gives:
{"time":"2024-08-26T20:54:40.750Z","level":"DEBUG","requestId":"ec1eeec6-6dc7-45a8-872e-19d360844d80","msg":"Loading customer with id=jane-doe"}
But I do not need a child logger, is there a way to pass this context directly to the (parent) logger?
The text was updated successfully, but these errors were encountered: