
I’m on the observability team at HashiCorp…so I’m super excited to get my telemetry all set up for this project. First, I’m starting with logs 🪵
When you’re working locally, you can add a console log or print statement to quickly debug any issues that pop up. However, once your application is deployed, you don’t know what issues are going to occur and you don’t have time when your website goes down to add a bunch of print statements and re-deploy your application to debug ⏳
So, we add a logger to our application and create structured log events in areas where we think we might want information about how a user is using our application or how our system is behaving 🕵🏻♀️
Why did I use the word structured? Well, we don’t just want the information about our system in a big old blob. We want queryable attributes that allow us to quickly observe our system. Having a structured log with key-value attributes gives us the freedom to get creative with our log queries to answer any questions we might have about how our application is running or how users are interacting with it 🚀
I used zerolog to set up a custom logger on my Golang API and added middleware to intercept requests and create structured logs with all of the info about the request that I want 👩🏻💻
What do you think?! 🤔
Want to develop your codings skills and network with other developers? Join the Coding with Callie community!
Coding with Callie – https://coding-with-callie.com/
LinkedIn – https://www.linkedin.com/company/coding-with-callie/