Disable Colors for PinoLogger
I am using pinoLogger and I wonder how can I disable the colors and modify the formatting (such as adding filename:linenumber)
4 Replies
Hi!
Here's how we internally define the pino logger: https://github.com/mastra-ai/mastra/blob/main/packages/loggers/src/pino.ts
You can customize the formatting with the formatters option: https://mastra.ai/reference/observability/logging/pino-logger
For example returns this
GitHub
mastra/packages/loggers/src/pino.ts at main ยท mastra-ai/mastra
The TypeScript AI agent framework. โก Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. - mastra-ai/mastra
Reference: PinoLogger | Observability | Mastra Docs
Documentation for PinoLogger, which provides methods to record events at various severity levels.
If you want to disable the color output, you need to set
overrideDefaultTransports (see https://github.com/mastra-ai/mastra/blob/main/packages/loggers/src/pino.ts#L25) and define a default transport (see https://github.com/mastra-ai/mastra/blob/main/packages/loggers/src/pino.ts#L43-L44)GitHub
mastra/packages/loggers/src/pino.ts at main ยท mastra-ai/mastra
The TypeScript AI agent framework. โก Assistants, RAG, observability. Supports any LLM: GPT-4, Claude, Gemini, Llama. - mastra-ai/mastra
๐ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10747
๐ If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly.
๐ Thank you for helping us improve Mastra!