question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: defaultMeta returns object not string

See original GitHub issue

🔎 Search Terms

defaultmeta

The problem

defaultMeta does’t appears as string in the log

const logger = winston.createLogger({
    level: 'info',
    format: production ? ecsFormat({ convertReqRes: true }) : winston.format.simple(),
    defaultMeta: { service: 'account' },
    transports: [new winston.transports.Console()]
});

but it displays service like that in the log

{
    "service":
    {
        "0": "a",
        "1": "c",
        "2": "c",
        "3": "o",
        "4": "u",
        "5": "n",
        "6": "t"
    }
}

What version of Winston presents the issue?

v3.3.3

What version of Node are you using?

v16.15.0

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

const logger = winston.createLogger({
    level: 'info',
    format: production ? ecsFormat({ convertReqRes: true }) : winston.format.simple(),
    defaultMeta: { service: 'account' },
    transports: [new winston.transports.Console()]
});

Additional information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
nTony46commented, Nov 8, 2022

Me and other students can work on this issue.

2reactions
renanyoycommented, Jun 21, 2022

@maverick1872 I have upgraded to winston 3.7.2 and it’s same

Read more comments on GitHub >

github_iconTop Results From Across the Web

'DefaultMeta' object is not iterable - python - Stack Overflow
I'm following cs50 tutorial lecture04 from which I get the following error. ERROR:- 'DefaultMeta' object is ...
Read more >
[3.0.0] Error object is not parsed or printed #1338 - GitHub
Logging a node Error object results in an empty message: ... If it's not an object then it's a string and format.json effectivley...
Read more >
A Complete Guide to Winston Logging in Node.js - Better Stack
Learn how to start logging with Winston in Node.js and go from basics to best practices in no time.
Read more >
register_meta() | Function - WordPress Developer Resources
Accepts 'post' , 'comment' , 'term' , 'user' , or any other object type with an associated meta table. $meta_key string Required. Meta...
Read more >
SQL expression object expected, got object of type <class ...
Interestingly, it works fine without the where() call, or if I use text() ... The error message says it got an object whose...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found