megahertz / electron-log

Simple logging module Electron/Node.js/NW.js application. No dependencies. No complicated configuration.
MIT License
1.27k stars 124 forks source link

Error with electron 28.0.0. When using the initialize function in the main process I get the following error: #384

Closed johannesjo closed 6 months ago

johannesjo commented 6 months ago

I get an error with electron 28.0.0, when using the initialize function in the main process:

Cannot read properties of undefined (reading 'initializeFn')
    at initialize (/home/johannes/www/super-productivity/node_modules/electron-log/src/core/Logger.js:120:10)

Originally posted by @johannesjo in https://github.com/megahertz/electron-log/issues/369#issuecomment-1859164807

megahertz commented 6 months ago

I think you import this lib as 'electron-log' instead of 'electron-log/main'

johannesjo commented 6 months ago

I think you import this lib as 'electron-log' instead of 'electron-log/main'

Just tried using import { initialize } from 'electron-log/main'; and import { initialize } from 'electron-log'; There is no difference in the outcome unfortunately. I am using the latest version (5.0.1) of electron log.

megahertz commented 6 months ago

Named import isn't supported since initialize is an instance method.

johannesjo commented 6 months ago

Thank you for the explanation! That solved the problem!