For many simple cases, there is a ready to use global variable already definelogger defined in the log package, log packagelog.Logger
. ThatThis global variablelogger can be configured through configuredlog.SetFlags
.
Afterwards one can just call the top level functions of the log package (likelike log.Printf
, and log.Fatalf
, ...), which use that global instance - even though the variable is not exported per se.