Open
Conversation
Owner
|
This will break python2.6 support, besides I think this could have been done by passing a custom logger, right? |
Author
|
A custom logger like this works: import os
import sys
import traceback
from retry.api import logging_logger
class location_logger(object):
@staticmethod
def warning(fmt, error, delay):
path, line, func, src = traceback.extract_tb(sys.exc_info()[2], 2)[1]
shortpath = os.path.join(os.path.basename(os.path.dirname(path)),
os.path.basename(path))
logging_logger.warning('%s:%s: %s, retrying in %s seconds...',
shortpath, line, error, delay)Feel free to discard this pull request, as built in support for location logging would be nice, but I am not sure about the right API. |
|
Just out of interest: Which part of this change breaks 2.6 compatibility? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This prefixes an exception message with file name and line number of the function invoked by
retrythat caused the exception;WARNING exceptionbecomesWARNING x.py:13: exception.Fixes #9