Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not print color log when go version is 1.10/1.11 #1547

Closed
thinkerou opened this issue Sep 14, 2018 · 7 comments
Closed

not print color log when go version is 1.10/1.11 #1547

thinkerou opened this issue Sep 14, 2018 · 7 comments
Labels

Comments

@thinkerou
Copy link
Member

  • With issues:

    • Use the search tool before opening a new issue.
    • Please provide source code and commit sha if you found a bug.
    • Review existing issues and provide feedback or react to them.
  • go version: go 1.11

  • gin version (or commit ref): master

  • operating system: mac

Description

Here can see go 1.8 1.9 1.10 1.11 print log: https://travis-ci.org/gin-gonic/gin/builds/428455260?utm_source=github_status&utm_medium=notification

when go version is 1.9 it will print log:

image

else print log:

image

Screenshots

@thinkerou thinkerou added the bug label Sep 14, 2018
@thinkerou
Copy link
Member Author

println(isatty.IsTerminal(os.Stdout.Fd())) on https://github.com/gin-gonic/gin/blob/master/logger.go#L60 will print false on go 1.11, but println(isatty.IsTerminal(os.Stdout.Fd())) on single file will print true on go 1.11. I don't know why?

@thinkerou
Copy link
Member Author

ping @mattn @thesyncim thanks

@mattn
Copy link
Contributor

mattn commented Sep 15, 2018

I didn't change anything for mac. (as far as I remember)

@thinkerou
Copy link
Member Author

@mattn thank you for yourreply.

@BrandonZacharie
Copy link

I got colors on macOS High Sierra and now Mojave. I only lose colors when running gin (i.e. gin -p 5000 -i run main.go) which wraps the process.

@kaustubhmallik
Copy link

@thinkerou will you be able to pick it, otherwise, I would love to help.

@thinkerou
Copy link
Member Author

@kamronbatman welcome

appleboy pushed a commit that referenced this issue Feb 20, 2019
Add a function `ForceConsoleColor`, like `DisableConsoleColor` but to force coloring the output.

It usefull when some IDE's integrated console (like IntelliJ or Goland) are not detected as TTY, but can display colors.

Also helps if one want to output color in log file (#1590) and as a workaround for #1547.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants