-
Notifications
You must be signed in to change notification settings - Fork 3
Description
FYI I've already changed the argument name from "logname" to "path" which is shorter and better reflects the pathlib.Path syntax elsewhere in log2d. Hope that's ok Mike?
Anyhow... this enhancement is to change the way you access other log files. Your original solution requires people to create an instance of the Log class first and give it a name. I think a better and conceptually better approach would be for people to type:
Log.find(path="another_log_file.log")
or in other words make it a Class method. This might be tricky to implement because we want a .find method for individual instances too - we might have to rename it e.g. Log.find_in("another_log_file.log") and be clever about reusing the core search logic between the class method and the instance method.
If you're not familiar with class versus instance methods I appreciate this isn't going to make much sense!
Here's the test I added to test_log2d.py:
def test_find_path():
create_dummy_log()
result = Log.find(path="mylog.log", date=timestamp, deltadays=-3)
assert len(result) == 6, f"FIND14: Anotherlog - Expected 6 lines found {len(result)}"