0

I'm having problems with the output of my log messages. I'm using logrus.

I'm developing with VS Code and when I debug my code the log output is:

time="2021-05-04T11:52:11+01:00" level=info msg=message

But when I'm running the app executable or use go run main.go the output is:

INFO[0007] message  

I want the first output.

What is happening?

EDIT:

We need to set the formatter as stated in the logrus github.

  • have you tried `To ensure this behaviour even if a TTY is attached, set your formatter as follows: log.SetFormatter(&log.TextFormatter{DisableColors: true, FullTimestamp: true})` from: https://github.com/sirupsen/logrus – Dian Bakti May 04 '21 at 14:51
  • I missed that. Yep that works. Thanks @DianBakti – Miguel Santos May 05 '21 at 09:42
  • Please create an answer for your own question and mark it so that other people know that this problem has been fixed and what the solution is. – guzmonne May 06 '21 at 18:00

1 Answers1

0

We need to set the formatter as stated in the logrus github