|
|
|
|
|
by the_af
1507 days ago
|
|
One thing that it takes some time to understand (and to teach to junior devs) is not only to add logs, but also useful logs. The stages of understanding go like this, in my experience: 1. Log nothing. 2. Upon being told to log things, write mostly useless logs: "Entering f() function", "leaving f() function". When f() fails, who knows what happened? 3. Upon being taught to add context so that logs can actually be used to troubleshoot problems, "entering f() with id 123", "id is 123", "writing 123", etc. 4. Enlightenment usually comes when logs include necessary info but are not redundant, are not noisy, and can actually be used to track down problems. Of course, improvement at step 4 is always ongoing, for all of us. |
|
They experience the problem with their own logging and realize through debugging their code what information they really wanted all along.