I am using the logging module in python 3 and want the specific warning message to be displayed only once. The problem is that the check is inside the loop:
def canned_example(): logger.warning("This function hasn't been created yet") for i in range(10): canned_example()
Is there a flag for the registration module that will mean that this particular warning should be displayed only once? An alternative is to keep a record of different flags, but I would like to keep it simple, if possible.
Update: Amir Yazdanbakhsh wrote a response in the comments that allows us to do this for all posts. Ideally, I need some flag for each message:
def canned_example(): logger.warning("This function hasn't been created yet", norepeat=True) for i in range(10): canned_example()
python
robertlayton
source share