You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the test I added to test_log2d.py which currently fails:
def test_find_without_loglevel():
""" fmt may not include loglevel e.g. ERROR. Test that .find still works"""
fmt = Log.presets['name_and_time']
mylog = Log("mylog", to_file=True, mode="w", to_stdout=True, fmt=fmt)
mylog("This format has no log level")
assert len(mylog.find()) == 1
cleanup()
I think your approach for .find is based on the Log Level as separator. Sadly this isn't going to work for all formats. Maybe another approach is based on either or both of:
a) Passing the separator explicitly as an argument e.g. mylog.find(text="search for this", separator="|")
b) We know what mylog.fmt is... perhaps we can derive the logic from this, at least for the 5 or so preset formats?
c) Use a handful of regexes e.g. one to find a datetime element (if any), one to find loglevel, one to find log name? Then compare to see if they all start/end with the same character e.g. "|" which is likely to be the separator?
The text was updated successfully, but these errors were encountered:
Here's the test I added to test_log2d.py which currently fails:
I think your approach for .find is based on the Log Level as separator. Sadly this isn't going to work for all formats. Maybe another approach is based on either or both of:
a) Passing the separator explicitly as an argument e.g. mylog.find(text="search for this", separator="|")
b) We know what mylog.fmt is... perhaps we can derive the logic from this, at least for the 5 or so preset formats?
c) Use a handful of regexes e.g. one to find a datetime element (if any), one to find loglevel, one to find log name? Then compare to see if they all start/end with the same character e.g. "|" which is likely to be the separator?
The text was updated successfully, but these errors were encountered: