I am not sure if the question is correctly scoped, but I want to learn more about asynchronous logging.
Lets say I have a function that performs heavy calculation like this:
async function calculateStuff() {
log("Beginning the calculation at ${timestamp.now}")
super_time_consuming_calc()
log("Ending the calculation at ${timestamp.now}")
}
Since the function is asynchronous, the "ending the calculation.." can execute before the calculation has actually finished, and if the calculateStuff is being run in an asynchronous loop, the "Beginning the calculation.." can get executed before the previous loop has completed execution as well. It seems like it's not possible to log with such precision in an async environment. Is that true? If not, what are the different ways to log in an async environment?