Make pino logger configurable via project.ts
livthomas opened this issue · 2 comments
Prerequisites
- Are you running the latest version(s)?
- Have you searched the documentation for your issue?
- Did you search for an existing issue or pull request?
Description
Right now, SubQuery allows only a very limited configuration of built-in pino
logger. It is only possible to set log level and output format but there is no way to set custom transports or other logger options.
Expected behavior: project.ts
file should have logger
field of type pino.LoggerOptions
which would be passed to the pino instance when it is being initialized in both the indexer and the GraphQL engine.
Actual behavior: It is only possible to choose whether logs are colored
or json
via --output-fmt
parameter and set the log level via --log-level
parameter.
Any other information
For example, I would like to configure the logger to send logs directly to Logtail (BetterStack Logs) instead of relying on syslog. There's @logtail/pino
transport that I already use in my app code but I would also like to use it in the SubQuery app.
Hi @livthomas
Thanks for the suggestion. At this time we don't think that expanding pino logging to support different transports is the right decision.
There are a few reasons for this:
- It would make shifting away from pino harder in the future if we were to do so
- Because it requires installing extra packages there is no easy way to add custom dependencies to the node/query services
- It's a potential security risk running untrusted code outside of a sandbox.
If you wish to add this functionality you're more than welcome to fork SubQuery and add it yourself.