You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

color_console_other.go 553B

1234567891011121314151617181920
  1. // Copyright 2022 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. //go:build !windows
  4. package log
  5. import (
  6. "os"
  7. "github.com/mattn/go-isatty"
  8. )
  9. func init() {
  10. // when running gitea as a systemd unit with logging set to console, the output can not be colorized,
  11. // otherwise it spams the journal / syslog with escape sequences like "#033[0m#033[32mcmd/web.go:102:#033[32m"
  12. // this file covers non-windows platforms.
  13. CanColorStdout = isatty.IsTerminal(os.Stdout.Fd())
  14. CanColorStderr = isatty.IsTerminal(os.Stderr.Fd())
  15. }