Questions tagged [logrus]

38 questions
0
votes
1 answer

Logrus logger pointer to specific log level

I am using MQTT paho library that has its own logger interface that is implemented by logrus logger, paho library has multiple levels: ERROR, CRITICAL and so on. I tried to do something like this: MQTT.ERROR = app.Log.WithField("level","ERROR") …
0
votes
1 answer

Log prints different outputs

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…
0
votes
2 answers

golang how to write logrus error to supervisord stderr_logfile automattically

I am using supervisord to run my golang app. My supervisord conf looks like [program:go_web] command=go-web-app autostart=true autorestart=true startsecs=3 stdout_logfile=/var/log/app.log stderr_logfile=/var/log/app_error.log and my logrus setup…
user2002692
  • 971
  • 2
  • 17
  • 34
0
votes
0 answers

Golang - logging panics to multiple loggers and files

so i have a go application that has 3 different log output files, and each file has its own logger. when the application panics, the panic trace will always be written to the last logger to be opened, even if the origin of the panic isn't related to…
Nitzanu
  • 84
  • 8
0
votes
1 answer

How to get the logger object back from request object once it's served by handler?

I am trying to learn how to use Middleware in Go. I am successful in sending the logger object with the request context to the handler functions. But once the request is processed and the logger object is filled with the data/errors from handler…
gaurav1999
  • 93
  • 11
0
votes
1 answer

Integrate elastic search with Logrus (golang logging)

I am using logrus to do all the logging my golang application. However, I also want to integrate this with Elastic Search such that all the logs are also flushed to elastic search when I create a logrus log entry. Currently all logs are created in a…
Amanda
  • 2,013
  • 3
  • 24
  • 57
0
votes
1 answer

Writing to existing file

here is the code: tmp, _ := os.OpenFile(filepath.Join(this.dirPath , "Log_"+time.Now().Format(conf.FormatFile())), os.O_CREATE|os.O_WRONLY, os.ModePerm) logrus.SetOutput(tmp) it works, but if the program is run again and a file with the same name…
-1
votes
1 answer

Is it possible to write a test to test the order of keys logged

Logrus logs keys alphabetically and this is what I want and need, but I would like to write a test to make sure that is not changed, I tried adding hooks but I don't think I can get access to the full log with the custom context I have added using…
M_K
  • 3,247
  • 6
  • 30
  • 47
1 2
3