You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the refactoring introduced in #614 the Logger utility only allows to log values that are of type Error or string.
As such it's not possible anymore to log an arbitrary object, which causes unneeded friction since the point of logger is to promote structured logging.
As a trivial example, I might want to log the event of my function:
This causes compile errors when using TypeScript (see below for details).
Expected Behavior
Types allow passing strings, Error, and arbitrary objects
Logger parses/structures each type correctly (i.e. strings are appended to a key & not broken down like it used to happen here, Error objects are broken down correctly, other types of objects are appended)
Current Behavior
Argument of type '[{ details: { event: APIGatewayRequestAuthorizerEvent; }; }]' is not assignable to parameter of type 'LogItemExtraInput'.
Type '[{ details: { event: APIGatewayRequestAuthorizerEvent; }; }]' is not assignable to type '[string | Error]'.
Type '{ details: { event: APIGatewayRequestAuthorizerEvent; }; }' is not assignable to type 'string | Error'.
Object literal may only specify known properties, and 'details' does not exist in type 'Error'.ts(2345)
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
dreamorosi
changed the title
Bug (logger): regression - not possible to log arbitrary objects
Bug: regression - not possible to log arbitrary objects
Nov 14, 2022
Bug description
After the refactoring introduced in #614 the Logger utility only allows to log values that are of type
Error
orstring
.As such it's not possible anymore to log an arbitrary object, which causes unneeded friction since the point of logger is to promote structured logging.
As a trivial example, I might want to log the
event
of my function:This causes compile errors when using TypeScript (see below for details).
Expected Behavior
Error
, and arbitrary objectsError
objects are broken down correctly, other types of objects are appended)Current Behavior
Possible Solution
N/A
Steps to Reproduce
Environment
Related issues, RFCs
#565
#614
The text was updated successfully, but these errors were encountered: