This PR fixes LogMonitor tool missing the first few log lines when the log file and directory are created after the LogMonitor tool has started. Issue #170
This regression is caused by the PR #149. The WaitForMultipleObjects() function waits until the timer expires even though the object is already created during the wait interval.
Summary of Fix
The fix adds a waitable object on the directory that the LogMonitor tool is observing. The WaitForMultipleObjects() function waits until either the timer expires or the specified file is created. By including the handle of the waitable object in the array, the function can return as soon as the file is created.
This way, the system does not have to wait for the entire duration specified by the timer if the file is created during the wait period. This makes the file monitoring more responsive and efficient.
What does this PR do?
This PR fixes LogMonitor tool missing the first few log lines when the log file and directory are created after the LogMonitor tool has started. Issue #170
This regression is caused by the PR #149. The WaitForMultipleObjects() function waits until the timer expires even though the object is already created during the wait interval.
Summary of Fix
The fix adds a waitable object on the directory that the LogMonitor tool is observing. The WaitForMultipleObjects() function waits until either the timer expires or the specified file is created. By including the handle of the waitable object in the array, the function can return as soon as the file is created.
This way, the system does not have to wait for the entire duration specified by the timer if the file is created during the wait period. This makes the file monitoring more responsive and efficient.