feat(logger): dev implementation#16304
Conversation
|
This comment was marked as outdated.
This comment was marked as outdated.
8724668 to
0ff369d
Compare
|
|
||
| export interface AstroLoggerDestination<T> { | ||
| write: (chunk: T) => boolean; | ||
| export interface AstroLoggerDestination<T = unknown> { |
There was a problem hiding this comment.
Why is this generic? AFAIK all implementations use AstroLoggerMessage
There was a problem hiding this comment.
I still need to refine this part of the architecture, so please bear with me while I add some funky stuff. The idea is that users will also need to log stuff (see the RFC), which means that logs emitted by the users will have a different shape, and hence the generic.
68ea534 to
40f21db
Compare
Changes
Closes AST-52
This PR starts the implementation of the new logger functionality. As for now, the implementation and usage is solely focused on development.
Docs haven't been written as they should, and I would like to keep it that way for now, I will focus on writing towards the end of the works.
Here's the RFC: withastro/roadmap#1339
Here's what's been done:
logHandlerswithjson, that returns a JSON loggernode, that returns the Node.js loggerconsole, that returns the console loggercompose, which allows to have multiple loggers togethercreate*Loggerfunctions. This means that the destination becomes an implementation detail.impls/folder._formattype I created few days ago, because it's not needed anymore, because the architecture took a different course.Important
This PR is a stacked PR against
feat/logger, which means tests won't probably run.Testing
I updated the existing tests to use the new pattern. Green CI.
I tested locally the new compose API and the new
jsonAPI.Docs
N/A