DEV Community

Cover image for Lets go on a ride with logs in Go
Donald Feury
Donald Feury

Posted on

Lets go on a ride with logs in Go

Shout out to my wife who makes these hilarious thumbnails, follow her on twitter and instagram for more art stuff.

Many programs benefit from logging certain information about what is going on. Maybe some part of your code returned an error and you want to make note of some details in relation to that error. Perhaps you want to see who is sending requests to your server and you capture some info such as the ip address and what type of service sent the request.

Regardless of your reason for using it, logging tends to be a good thing to integrate into your program at some point or another.

Luckily, go has a basic log package in the standard library. While it lacks some features you may see in 3rd party logging frameworks, it can fulfill some basic use cases.

Check out the video tutorial where I go over some examples of using, not only the standard log package, but a useful 3rd party logging package called logrus

If you liked it and want to know when I post more tutorials, be sure to subscribe and thank ya'll again for your time!

Top comments (2)

djamaile profile image

Cool series man. Any plans to go deeper with Cobra & viper?

dak425 profile image
Donald Feury

I'm planning a video where we use cobra and viper to actually build something, trying to decide on what.

Leaning towards something I want to build anyway, like a discord bot.