grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Merged in termdumb (pull request #2)
2019-04-18, Gary Kramlich
192d0f174bf4
Parents
3c290648b1c5
f5cf0e9c5831
Children
ebd2fc7bc10c
8c7e5a1b48ed
Merged in termdumb (pull request #2)
logrus: disable colors if term is "dumb"
Approved-by: Gary Kramlich
1 files changed, 9 insertions(+), 2 deletions(-)
+9
-2
main.go
--- a/main.go Thu Apr 18 15:26:05 2019 -0500
+++ b/main.go Thu Apr 18 23:15:44 2019 +0000
@@ -19,9 +19,16 @@
func init() {
log.SetOutput(os.Stdout)
log.SetLevel(log.DebugLevel)
- log.SetFormatter(&log.TextFormatter{
+ fmter := &log.TextFormatter{
FullTimestamp: true,
- })
+ }
+ switch os.Getenv("TERM") {
+ case "win":
+ fallthrough
+ case "dumb":
+ fmter.DisableColors = true
+ }
+ log.SetFormatter(fmter)
}
func main() {