When will we register: before the function call (example A) or at the beginning of the target method (example B)?
Note that this question is about the exact placement of calls to the logger function, not the general best logging methods.
Solution A: the log when calling the function :
function someProcess() {
log.info("Reading data");
readDataFromIO();
log.info("Outputing data");
outputDataToScreen();
}
function readDataFromIO() {
...
}
function outputDataToScreen() {
...
}
Solution B: log at the start of the method
function someProcess() {
readDataFromIO();
outputDataToScreen();
}
function readDataFromIO() {
log.info("Reading data");
...
}
function outputDataToScreen() {
log.info("Outputing data");
...
}
A , , , . B , 100%, , , , . ?