I'm creating some structured logging for my application and I wanna check the output of it. For the logging, I'm using Python default logger and pytests for the tests (unittest is not an option in this project). I wanna assert the output I get from the logging against a fixed text and in order to do it I need to have a fixed datetime. But doesn't matter what I do I can't override the Python Logger datetime. How can I mock the datetime I get from the python logger in order to have a proper test?
Update
It's not a formater that I need, I actually need the expected Datetime as result always when I run the tests. So how many times I call the logger, it will always respond with the same Datetime Value, for instance: 2001-01-01
.