lileio / lile

Easily generate gRPC services in Go ⚡️
MIT License
1.5k stars 88 forks source link

logger write escape sequence on Windows command prompt #35

Closed mattn closed 6 years ago

mattn commented 6 years ago

logrus in default output escape sequence like this:

See https://github.com/sirupsen/logrus#formatters

mattn commented 6 years ago

One of solutions is disable colors on Windows.

arbarlow commented 6 years ago

closing due to inactivity, but I was wondering if this happens in powershell too?

mattn commented 6 years ago

Do you remember that lile had already support cmd.exe? https://github.com/lileio/lile/pull/14

arbarlow commented 6 years ago

ah cool, so we're good!

mattn commented 6 years ago

So that you want to:

Which do you want?

arbarlow commented 6 years ago

hmm, I'm happy to support windows if that's what's no right. Is it logrus that's the issue, does logrus not work on windows?

mattn commented 6 years ago

logrus works on Windows but colors are not enabled in default.

    logrus.SetOutput(colorable.NewColorableStdout())
    logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})

This is a code to enable colors on Windows. lile should generate this code with lile new.

arbarlow commented 6 years ago

Ah ok, but above you should bad output, is that what you mean by "colors are not enabled in default"?

mattn commented 6 years ago

Windows cmd.exe doesn't handle escape sequence. Also logrus doesn't enabled colors in default. #45 should fix this.