Skip to content

Update spdlog#11

Merged
deepak1556 merged 8 commits intomainfrom
rzhao271/update
May 4, 2021
Merged

Update spdlog#11
deepak1556 merged 8 commits intomainfrom
rzhao271/update

Conversation

@rzhao271
Copy link
Collaborator

@rzhao271 rzhao271 commented Apr 20, 2021

This PR updates the spdlog submodule to v1.8.5, and fixes our code where needed.

  • We now have an initThreadPool method rather than a setAsyncMode method.
  • The implementation of the VoidFormatter has also changed.

Affects microsoft/vscode#121513

I tested my changes by running npm rebuild and then npm run test using node v15.14.0. I did not use electron-rebuild, because I couldn't find a way to issue npm run test commands after running it; I'd get messages like

Error: The module '/Users/raymondzhao/work/node-spdlog/build/Release/spdlog.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 88. This version of Node.js requires
NODE_MODULE_VERSION 83.

if I used electron-rebuild or node v14.16.0.

Maybe this means that the spdlog submodule has to somehow be rebuilt with the right version of node, though I'm not sure how.

@rzhao271 rzhao271 requested a review from deepak1556 April 20, 2021 21:36
@rzhao271 rzhao271 self-assigned this Apr 20, 2021
@deepak1556
Copy link
Contributor

Once you have built for electron you need to use ELECTRON_RUN_AS_NODE=1 electron.exe <path-to-mocha-binary>

@rzhao271
Copy link
Collaborator Author

That worked! All the tests are still passing.

@gabime
Copy link

gabime commented Apr 21, 2021

In spdlog 1.x calling init_thread_pool(..) is not enough to make the loggers async. see https://github.com/gabime/spdlog/wiki/6.-Asynchronous-logging#creating-async-loggers

Copy link
Contributor

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs change to implement the new way of creating async loggers as mentioned by @gabime

@rzhao271
Copy link
Collaborator Author

rzhao271 commented Apr 21, 2021

A few changes

@rzhao271 rzhao271 requested a review from deepak1556 April 21, 2021 23:57
@rzhao271
Copy link
Collaborator Author

Due to microsoft/vscode#121852, I'll add another function that creates a synchronous logger during debt week.

@rzhao271 rzhao271 force-pushed the rzhao271/update branch from c782453 to 33ce7af Compare May 4, 2021 16:05
@rzhao271 rzhao271 requested a review from deepak1556 May 4, 2021 16:59
@gabime
Copy link

gabime commented May 4, 2021

switch back to using _mt loggers, since the flushing requires thread-safe loggers to work

Actually _mt is not required if the sinks are used only in async logger(and as long the thread was pool has single thread).

@deepak1556
Copy link
Contributor

Thanks for the context @gabime, have confirmed with @rzhao271 that vscode uses the sync logger and async logger from different processes so it is safe to use the _st version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants