Tools: I Added Userid And Transactionid To Every Console.log Without...

Tools: I Added Userid And Transactionid To Every Console.log Without...

Posted on Jan 21

• Originally published at purpleowl.io

Almost every JavaScript server starts the same way.

You add a few console.log() calls so you can see what's happening. You deploy. Everything works.

The problem is that this version of "fine" only exists while your system is still small.

As soon as you have multiple users, concurrent requests, and background jobs, logging quietly stops being helpful. Nothing breaks—but nothing is understandable anymore.

All of that generates logs. Now multiply by hundreds of users doing the same thing at the same time.

Is fine—until you see it 10,000 times a day and have no idea which one matters.

Eventually someone says: "We should really fix logging."

For small teams, that's not a small task. It's a refactor with no visible feature payoff, so it gets kicked down the road.

So instead of designing a "proper" logging framework, we imposed a hard constraint:

Source: Dev.to