You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the same code when executed in a Worker or SharedWorker does not log to console, instead I have to logger.getLogger('somelogger').info('hello world') to achieve the same effect, this makes working with a global logger instance difficult as any methods using the logger need to now accept it as an instance in a worker.
The text was updated successfully, but these errors were encountered:
Can you share a complete, working example of this? I’m not sure how to reproduce it.
Since the default level is WARN, this shouldn’t normally log anything in any environment. I assume you either have a saved level (which a worker may not have access to) or you are calling setLevel() or setDefaultLevel() somewhere else in your code before calling logger.info(...). Loglevel doesn’t have native support for import, either, so there might also be an issue caused by whatever builder/bundler you’re using.
If I change your example to use logger.warn() and build the worker script with esbuild, it works fine for me, but that obviously doesn’t match whatever your complete setup is.
In a regular web application I can simply:
the same code when executed in a
Worker
orSharedWorker
does not log to console, instead I have tologger.getLogger('somelogger').info('hello world')
to achieve the same effect, this makes working with a global logger instance difficult as any methods using the logger need to now accept it as an instance in a worker.The text was updated successfully, but these errors were encountered: