Skip to content

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

@shmillar

Description

@shmillar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions