Console.log() sudden weirdness with peruse-mock and 'yarn dev'

@joshuef This is not a problem I need help with just now, as I have a solution, but I’m reporting in case others have problems and to find out if there is an explanation.

For weeks now I’ve been using a very slightly modified (one line commented out) build of peruse for mock to test the code I’m writing. All this time I’ve just been using yarn dev to run peruse and opening a browser debug console to see my console.log output messages, set breakpoints in my code etc. (Actually I’m using an npm module called ‘debug’, for console.log rather than console.log() statements, so it might be something related to that.)

This worked fine until today. Then for no reason I can think of, the console.log output stopped, and the web app began to behave a bit oddly. I tried all sorts, including reverting to older code, and could not find a reason or fix this.

I then tried the release/linux-unpacked/peruse image that I built a few weeks ago and hey presto, that works. And it works with my latest code too, so for some reason yarn dev suddenly stopped behaving.

I might have done an update of system packages today, but I definitely didn’t do anything in my peruse-mock directory other than yarn dev so I’m curious as to what might suddenly cause it to behave differently.

Might yarn dev have updated some packages in my peruse-mock? Any other ways it might have been broken. The only other git diff in my peruse-mock is an extra file which I think you provided for me: resources/electron.safe_core.config

Cheers. Anyway, it’s a relief to have sorted this - took me all day.

2 Likes

Hmmmm, not sure what could have happened to be honest.

May be that the mock vault became corrupted (can happen sometimes… I’m not sure of any specific trigger). But that’s all I can think of, sorry. Yarn dev wouldn’t be updating any packages. It simply runs a few webpack scripts.


On the log topic, peruse uses electron-log, which can be imported and used in most scripts (bot main or renderer), via import logger from 'logger', and then used thus: logger.info('blabla', bla). Same as console.log but writes to main process output, a log file and the renderer process logs all together. Not sure if that’s handy for you or no, but just FYI!

1 Like