-
Notifications
You must be signed in to change notification settings - Fork 885
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
Accessing log level label from transport #1925
Comments
Your assessment is correct. I think passing the custom level information down to the worker thread would be a very nice feature addition, if you'd like to send a PR. |
@mcollina PRs are open for this now.
Most of the changes are in pino-abstract-transport. Looking forward to your feedback. |
I think it would be safer/easier to pass it via workerData. Why did you pass it via postMessage? |
I passed it via postMessage because the worker is created before the pino instance, so that information isn't available to include in workerData. |
WorkerData could potentially work for pino({
transport: {
target: '/absolute/path/to/my-transport.mjs'
}
}) But would not support pino(pino.transport({
target: '/absolute/path/to/my-transport.mjs'
}) |
@mcollina what are your thoughts? Do you want to only support this feature when including the transport on the config? Or am I missing something here that would work for workerData when calling |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Related: pinojs/pino-opentelemetry-transport#155
In the pino-opentelemetry-transport, I'm using the level label as SeverityText on the log record. Since the log object only has the level number, and the transport doesn't have access to the logger itself to read
logger.levels
, I'm using the label frompino.levels
for SeverityText. This becomes a bit of a problem though for custom levels.If a user is using any custom levels in their pino configuration, they'll have to pass that same configuration again to the transport in order to be able to use the level label.
Is there a way that I'm missing that exists to access the level label from the transport without having to do this?
The text was updated successfully, but these errors were encountered: