megahertz/electron-log

Incorrect logging of nested objects and dates

madmurl0c opened this issue · 2 comments

I recently noticed that some outputs in my logs seemed odd, it seems like some values don't get logged correctly.
To be more precise I noticed that JS Dates get logged as {} and a boolean values (when inside an object) as '[boolean]'

Example:

This is what it looks like in the DevTools:
image

This is what gets logged:

[2024-01-09 14:37:47.833+01:00] [info]  [renderer] {}
[2024-01-09 14:37:53.705+01:00] [info]  [renderer] { bool: true }
[2024-01-09 14:38:01.817+01:00] [info]  [renderer] { nested: { obj: { bool: '[boolean]' } } }

Configuration:

main:

...
log.initialize({ preload: true });
log.transports.file.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}{z}] [{level}] [{processType}]{scope} {text}';
log.transports.file.level = 'debug';
...

renderer.ts:

import log from 'electron-log/renderer';
...
console.log = log.log

electron-log version: 5.0.3

Did is misconfigure something or is this a bug?

Thanks for the report. I'll investigate that this week.

Fixed in electron-log@5.1.0-beta.2