> Log after, not before
I tried this recently by accident, and the drawback of that approach immediately became apparent:
The logs will be very difficult to read, because for nested function calls, low-level callee functions will log before high-level caller functions, and you have no idea why they are called until later:
Finished string comparison of length 4
... 200 more lines...
Finished string comparison of length 2
Finished Boyer-Moore string search
Finished searching for example.com
Finished searching for disallowed domains
Finished checking email address
Finished logging in user
With the suggested approach, you'll have to read your logs backwards to make sense of them.