github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/log/console_other.go (about) 1 // Copyright 2023 The GitBundle Inc. All rights reserved. 2 // Copyright 2017 The Gitea Authors. All rights reserved. 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file. 5 6 //go:build !windows 7 8 package log 9 10 import ( 11 "os" 12 13 "github.com/mattn/go-isatty" 14 ) 15 16 func init() { 17 // when running gitbundle as a systemd unit with logging set to console, the output can not be colorized, 18 // otherwise it spams the journal / syslog with escape sequences like "#033[0m#033[32mcmd/web.go:102:#033[32m" 19 // this file covers non-windows platforms. 20 CanColorStdout = isatty.IsTerminal(os.Stdout.Fd()) 21 CanColorStderr = isatty.IsTerminal(os.Stderr.Fd()) 22 }