Last active
December 3, 2019 04:57
-
-
Save stephen-soltesz/0ac8a299f29d99f7f953ec11dd562268 to your computer and use it in GitHub Desktop.
Example usage of logx.Loggers() and logx.Setup()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"flag" | |
"log" | |
"github.com/m-lab/go/flagx" | |
"github.com/m-lab/go/logx" | |
"github.com/m-lab/go/rtx" | |
) | |
// Optionally define local variables with self-describing names. | |
var debug = logx.Debug | |
func main() { | |
flag.Parse() | |
log.SetFlags(log.Ldate | log.Lmicroseconds | log.LUTC | log.Lshortfile) | |
rtx.Must(flagx.ArgsFromEnv(flag.CommandLine), "Failed to parse flags") | |
rtx.Must(logx.Setup(), "Failed to init logx package") | |
log.Println("this is standard log") | |
logx.Debug.Println("debug message") | |
log.Println("this is standard log") | |
debug.Println("inline debug message") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment