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

add fail log method, make hardcoded stuff in raiseException easy to redefine for deriving classes #156

Merged
merged 3 commits into from
Feb 18, 2015

Conversation

boegel
Copy link
Member

@boegel boegel commented Feb 17, 2015

@stdweird, @JensTimmerman: please review

@hpcugentbot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/218/
Test PASSed.

@@ -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)
Copy link
Contributor

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

Copy link
Member

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?

Copy link
Member Author

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

@JensTimmerman
Copy link
Contributor

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)
Copy link
Member

Choose a reason for hiding this comment

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

use message, *args here

Copy link
Member

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...

Copy link
Member Author

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

@boegel
Copy link
Member Author

boegel commented Feb 17, 2015

remarks fixed, please rereview?

@JensTimmerman
Copy link
Contributor

looks ok now, version is bumped in different pull request?

@hpcugentbot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/219/
Test FAILed.

@hpcugentbot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/220/
Test FAILed.

@JensTimmerman
Copy link
Contributor

jenkins: test this please

@hpcugentbot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/221/
Test FAILed.

@boegel
Copy link
Member Author

boegel commented Feb 17, 2015

Jenkins: test this please

@boegel
Copy link
Member Author

boegel commented Feb 17, 2015

@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)

@boegel
Copy link
Member Author

boegel commented Feb 17, 2015

Jenkins: test this please

@hpcugentbot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://jenkins1.ugent.be/job/vsc-base-pr-builder/222/
Test PASSed.

@boegel
Copy link
Member Author

boegel commented Feb 17, 2015

green light now the GitHub issues are resolved, and Jenkins is happy again

@stdweird, @JensTimmerman: ready to be merged in?

JensTimmerman added a commit that referenced this pull request Feb 18, 2015
add fail log method, make hardcoded stuff in raiseException easy to redefine for deriving classes
@JensTimmerman JensTimmerman merged commit 36d7235 into hpcugent:master Feb 18, 2015
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.

4 participants