log2d
log2d copied to clipboard
.find by level broken
I think this is my fault - many apologies Mike!
When refactoring the variable names I must've broken the level= logic, such that the following test (which I've added to test_log2d.py) doesn't work but should!:
@create_mylog
def test_find_levels():
Log.mylog.info("Oneline")
assert mylog.find(level="error") == []
assert mylog.find(level="ERRor") == []
assert len(mylog.find(level="info")) == 1
assert len(mylog.find(level="InFo")) == 1
This test is also failing for the same reason:
def test_find_by_level():
create_dummy_log()
mylog.logger.error(f"Message: Yet another last line")
result = mylog.find(text="error")
assert "ERROR" in result[0], f"FIND5: ERROR message not found"
result = mylog.find(text="error", ignorecase=False)
assert not result
result = mylog.find(level="error")
assert len(result) == 6, f"FIND6: Expected 6 records, found {len(result)}"
cleanup()
I'm hoping you can spot where I've gone wrong and put it right using PEP8/snake_case variable names please?
I owe you!
Fixed in pull request #17