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
Conversation
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"if" -> "of"
ec83c98
to
b4f1ff9
Compare
There was a problem hiding this 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.
@timj, thanks! I'll try to find someone to look at mutex stuff. Always worth to have someone else checking multi-threading code 👀 |
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🙂 )
This also requires support for pickle in Log class, added simple __reduce__ method.
b4f1ff9
to
f890ef8
Compare
In addition there are few small improvements:
Log
class now supportspickle
so it can work withmultiprocess
Log.getChild
method to make it look more like Pylonlogging
logger, this is also a better replacement for hierarchical "context" management if someone needs that