Integrating logrus with cobra

by Sebastien le gall, at 17 January 2019, category : Go Logrus Cobra

You can find a working example on my GitHub:

I recently had to refactor the way one of my app print logs. My idea was to use logrus as it is a very well known lib to produce logs with Go.

Logrus let you print nicely color-coded and structured logs and is completely API compatible with the standard library logger.


My first question was about log level and how to setup it once across all sub-directory/package of my project.

Under the hood, logrus instantiate a new variable log. Once done, calling the logrus.SetLevel() function will store the level directly in this newly instantiated struct.

Thus, we have a global struct, available across all sub-package making the level automatically shared without having to use dependency injection.

If you need to set a different level in a sub-package (for example), you just need to instantiate a new logger :

var log = logrus.New()


log.Debug("debug log")

read more

The bottom-up performance review

by Sebastien le gall, at 15 January 2019, category : Management Agile Management 3.0

performance review

The performance review is a common way to regularly give or get feedback about the work that has been done. Some company performs those once a year, other twice a year. Agile teams may do it more frequently. In my previous experiences, the retrospective we were doing after each sprint was a way to give personal feedback and once a year we were doing a yearly retrospective to summarize the whole past year, as a team.

read more