-
Notifications
You must be signed in to change notification settings - Fork 51
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
add fail log method, make hardcoded stuff in raiseException easy to redefine for deriving classes #156
add fail log method, make hardcoded stuff in raiseException easy to redefine for deriving classes #156
Conversation
…edefine for deriving classes
Refer to this link for build results (access rights to CI server needed): |
@@ -174,6 +174,10 @@ class FancyLogger(logging.getLoggerClass()): | |||
# this attribute can be checked to know if the logger is thread aware | |||
_thread_aware = True | |||
|
|||
# default class for raiseException method, that can be redefined by deriving loggers | |||
DEFAULT_RAISE_EXCEPTION_CLASS = Exception | |||
DEFAULT_RAISE_EXCEPTION_LOG_METHOD = lambda c, msg: c.warning(msg) |
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 wouldnt call it default if it's supposed to be changed by something later on.
so just go with RAISE_EXCEPTION_CLASS
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.
is the lambda really required here?
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.
yes, you can't refer to a method while defining the class
bump version please |
def fail(self, message, *args): | ||
"""Log error message and raise exception.""" | ||
formatted_message = message % args | ||
self.DEFAULT_RAISE_EXCEPTION_LOG_METHOD(formatted_message) |
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.
use message, *args
here
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.
well, not if you really have to use a lambda...
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.
indeed, and why let the logger reformat the string, we already have a formatted version
remarks fixed, please rereview? |
looks ok now, version is bumped in different pull request? |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
jenkins: test this please |
Refer to this link for build results (access rights to CI server needed): |
Jenkins: test this please |
@JensTimmerman: the version is bumped as requested, but GitHub isn't showing it here, seems like it's in trouble (may be related to the unit test issues on Jenkins) |
Jenkins: test this please |
Refer to this link for build results (access rights to CI server needed): |
green light now the GitHub issues are resolved, and Jenkins is happy again @stdweird, @JensTimmerman: ready to be merged in? |
add fail log method, make hardcoded stuff in raiseException easy to redefine for deriving classes
@stdweird, @JensTimmerman: please review