Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-17874: Remove ContextLog class and related code #40

Merged
merged 6 commits into from Feb 15, 2019

Conversation

andy-slac
Copy link
Contributor

In addition there are few small improvements:

  • initialization/configuration step is made thread safe, and less confusing
  • Python Log class now supports pickle so it can work with multiprocess
  • added Log.getChild method to make it look more like Pylon logging logger, this is also a better replacement for hierarchical "context" management if someone needs that

This commit is just to test that dependencies still work fine. There
will be more changes to simplify Log class and update documentation and
examples.
src/Log.cc Outdated
* Return a logger which is a descendant to this logger.
*
* If for example name if this logger is "main.task" and suffix is
* "subtask1.algorithm" then this method will return logger with tthe name
Copy link
Member

Choose a reason for hiding this comment

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

"tthe"

src/Log.cc Outdated
/**
* Return a logger which is a descendant to this logger.
*
* If for example name if this logger is "main.task" and suffix is
Copy link
Member

Choose a reason for hiding this comment

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

"if" -> "of"

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

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

Looks good to me although some of the C++ mutex stuff is beyond me.

@andy-slac
Copy link
Contributor Author

@timj, thanks! I'll try to find someone to look at mutex stuff. Always worth to have someone else checking multi-threading code 👀

Copy link
Contributor

@ktlim ktlim left a comment

Choose a reason for hiding this comment

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

I'm a little worried about the need to pickle and pass the logger in examples/mp.py. I think it may be better to not have the a() and b() loggers be relative to the parent, but that's a separate change.

src/Log.cc Outdated

if (! skipInit) {
std::lock_guard<std::mutex> lock(configMutex);
if (! initialized) {
Copy link
Contributor

Choose a reason for hiding this comment

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

https://developer.lsst.io/cpp/style.html#the-following-white-space-conventions-should-be-followed says "No spaces separating unary operators and their arguments." (The old code was wrong.)

@@ -110,13 +109,22 @@ void defaultConfig() {
root->setLevel(log4cxx::Level::getInfo());
}

// Protects concurrent configuration
std::mutex configMutex;
Copy link
Contributor

Choose a reason for hiding this comment

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

You might consider putting configMutex and initialized in an anonymous namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is in anonymous namespace with other code surrounding it (probably too much code in that namespace 🙂 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants