Replies: 3 comments 1 reply
-
the current hardcoded logger is specifically painful for error handling where an error is split up onto multiple lines. } catch (err) {
this.#logger.error(null, err.stack || err.message || String(err));
return this.#renderError(request, { locals, status: 500 });
} Therefore, even if I created a custom node adapter I wouldnt be able to overwrite the |
Beta Was this translation helpful? Give feedback.
-
+1 x 1000 As Astro adds more back-end features from actions to SSR configurable logging is a must-have feature because it is essential for any real-world business / enterprise applications. A great example of a business-friendly Node framework that has great support for configurable logging is NestJS. Check out the docs page for loggers and note how the expectation is that production applications will have specific logging requirements and will replace the built-in logger with their own. This is detailed in the last section "Use external logger": https://docs.nestjs.com/techniques/logger#use-external-logger ALL logs coming from Astro must be wired through the logger including those from integrations. Just like NestJS, no log entry should be able to "slip by" and be emitted in an invalid format. NO logs by any official code or integration should be emitted using hardcoded Consider the common use-case mentioned by the OP for structured logging in JSON format. Custom loggers need to be supported to meet industry & compliance requirements such as data cleaning / scrubbing of sensitive fields as well as various business requirements. When this requirement is met, developers can use log data to feed event buses + event streams, it can be dumped into log aggregation services where it can be made searchable / trigger notifications, and it can be dumped into storage buckets where it can be queried with Apache Parquet / AWS Athena. Structured data is easily analyzed by machine learning, etc. Ultimately this will enable Astro-based applications to fully "plug in" to a larger business or enterprise landscape and greater IT architecture. For the record it is NOT an option to monkey patch |
Beta Was this translation helpful? Give feedback.
-
I believe it's really important for Astro.js to have this feature, especially for people like me who like to self-host their apps and manage everything themselves. For those using tools like Loki and Grafana to collect and view logs, being able to easily send logs from Astro.js would be super helpful. It would make it much easier for them to keep an eye on things, analyze data, and fine-tune their systems. |
Beta Was this translation helpful? Give feedback.
-
Body
Summary
I would like to be able to get all my logs in json format (node adapter).
Background & Motivation
When running astro with node in production I want my logs to be json formatted in order to simplify monitoring. Currently
astro uses a hardcoded
consoleLogDestination
which makes it impossible to get this to work.Goals
Being able to provide a custom logger (see pino) would allow me to
Beta Was this translation helpful? Give feedback.
All reactions