vector
vector copied to clipboard
[DNM] Add logOperationTime util with implementation in protocol module
The Problem
- We need accurate logging to document time it's taking for methods to execute, starting with protocol module
The Solution
- Implemented logOperationTime, a util method
- Used at start and completion of a method to log start and time it took to execute, respectively
- Used performance(.mark()) as opposed to Date.now() for accuracy
We should make this time logging part of the "debug" log config. IMO it should be in the code and be able to be enabled with a "switch flip" of sorts.
We should make this time logging part of the "debug" log config. IMO it should be in the code and be able to be enabled with a "switch flip" of sorts.
Can you clarify what you mean by "debug" log config? Is there a configuration somewhere I should be aware of? The way it is currently, unless the method takes an inordinate amount of time to execute, it will always log it on debug level. Takes too long and it logs it as info, then warning
Can you clarify what you mean by "debug" log config? Is there a configuration somewhere I should be aware of? The way it is currently, unless the method takes an inordinate amount of time to execute, it will always log it on debug level. Takes too long and it logs it as info, then warning
https://docs.connext.network/configuring-a-router here's the config.
Your implementation sounds good. The main thing I was trying to get at is we should have the ability to turn this on/off in the config. So as part of this PR I think we should add a config item called enableTimestampLogging or something which can turn the whole thing on/off.
https://docs.connext.network/configuring-a-router
Ah, I misread your first comment. I thought you said it should NOT be able to be enabled by switch flip of sorts , haha.
Yes, agreed. I will target that functionality for this PR, thanks. (Meaning I will include addition of this config item)
EDIT: I'm going to go out on a limb and assume the responsibility to 'check' the switch should be relegated to the method itself (meaning I'll check the enableTimestampLogging config setting within the logOperationTime method)