fullstack-build / tslog

📝 tslog - Universal Logger for TypeScript and JavaScript
https://tslog.js.org
MIT License
1.35k stars 63 forks source link

Bug: Map created and populated in the same function being logged as empty Object #213

Closed shmillar closed 1 year ago

shmillar commented 1 year ago

Hello, I am using TSLog in my project, and am coming across a weird scenario where the debug log is not printing a map being defined in the same function. I have tried console logging the map within the same function and am having no issues. I will include pseudocode below to illustrate what I mean.

public logger = new Logger({ name: 'myLogger'});

myFunction() { let map = new Map(); map.set('foo', 'bar'); this.logger.debug('My Map: ', map) // prints in console "DEBUG myLogger My Map: {}" console.log('My Map: ', map) // prints in console "My Map: Map(1) { 'foo' => 'bar' }" }

I am expecting a log to show something like this: "DEBUG myLogger My Map: Map(1) { 'foo' => 'bar' }"

node version v16.17.0 "tslog": "^4.7.1" Windows 11, running in Edge Browser

terehov commented 1 year ago

Thank you, I see that maps and sets weren't cloned properly. I'll release a fixed version shortly.

shmillar commented 1 year ago

@terehov Thank you so much for the quick reply!

terehov commented 1 year ago

V4.7.3 is out fixing this.