feat(oohelperd): log messages at info level (#896)
We're using a request-specific logger where we also print the ID of the request. This design helps to observe logs produced by concurrent requests. Part of https://github.com/ooni/probe/issues/2183 While there, fix https://github.com/ooni/probe/issues/2241
This commit is contained in:
parent
8ca7645026
commit
4241ee4bc1
11 changed files with 225 additions and 27 deletions
41
internal/cmd/oohelperd/logging.go
Normal file
41
internal/cmd/oohelperd/logging.go
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package main
|
||||
|
||||
import "github.com/ooni/probe-cli/v3/internal/model"
|
||||
|
||||
// indexLogger is a logger with an index.
|
||||
type indexLogger struct {
|
||||
indexstr string
|
||||
logger model.Logger
|
||||
}
|
||||
|
||||
var _ model.Logger = &indexLogger{}
|
||||
|
||||
// Debug implements DebugLogger.Debug
|
||||
func (p *indexLogger) Debug(msg string) {
|
||||
p.logger.Debug(p.indexstr + msg)
|
||||
}
|
||||
|
||||
// Debugf implements DebugLogger.Debugf
|
||||
func (p *indexLogger) Debugf(format string, v ...interface{}) {
|
||||
p.logger.Debugf(p.indexstr+format, v...)
|
||||
}
|
||||
|
||||
// Info implements InfoLogger.Info
|
||||
func (p *indexLogger) Info(msg string) {
|
||||
p.logger.Info(p.indexstr + msg)
|
||||
}
|
||||
|
||||
// Infov implements InfoLogger.Infov
|
||||
func (p *indexLogger) Infof(format string, v ...interface{}) {
|
||||
p.logger.Infof(p.indexstr+format, v...)
|
||||
}
|
||||
|
||||
// Warn implements Logger.Warn
|
||||
func (p *indexLogger) Warn(msg string) {
|
||||
p.logger.Warn(p.indexstr + msg)
|
||||
}
|
||||
|
||||
// Warnf implements Logger.Warnf
|
||||
func (p *indexLogger) Warnf(format string, v ...interface{}) {
|
||||
p.logger.Warnf(p.indexstr+format, v...)
|
||||
}
|
||||
Loading…
Reference in a new issue