Comments (9)
Hi @gl-works it should be possible to support multiple levels, but there's a lot at the DEBUG
level that we could probably make better use of a TRACE
level for (things that are proportional to the traffic being handled).
from memberlist.
Hi @slackpad - I'd like to bump this up as well.
We use https://github.com/uber-go/zap to take care of the application level logging and there is sadly no-way to interface with this given the current implementation.
Could you give quick yes/no on your thoughts on this, as I'm thinking of nominating myself for a PR?
from memberlist.
We are still working on standardizing the logger across our different tools so we should hold off until we figure out the direction for that. I'll update this once I have more info.
from memberlist.
With a couple of changes it's already fine for me. The changes are compatible with the current logging, so existing code that uses memberlist does not have to be modified. I can submit a pull request if that would be appreciated.
Edit: I did remove the memberlist:
prefix from log messages. If I'd put that back, it would be exactly the same as it is now.
from memberlist.
Hi @htdvisser we've now got https://github.com/hashicorp/go-hclog so we plan to port to that interface.
from memberlist.
Ok, thanks, I'll keep an eye on that
from memberlist.
Hi, any news about the port to https://github.com/hashicorp/go-hclog? Would be happy to work on it if it's not a priority!
from memberlist.
Here's a very dirty workaround I'm using until we get a pluggable interface logger. It's meant to work with logrus.FieldLogger
, but could also be adjusted to any other logger. Maybe it'll help someone else:
type logParser struct {
logrus logrus.FieldLogger
regexp *regexp.Regexp
}
func newLogParser(logrus logrus.FieldLogger) *logParser {
return &logParser{
logrus: logrus,
regexp: regexp.MustCompile(`(.*)\[(DEBUG|ERR|ERROR|INFO|WARNING|WARN)](.*)`),
}
}
func (l *logParser) Write(in []byte) (int, error) {
res := l.regexp.FindSubmatch(in)
if len(res) != 4 {
l.logrus.Warnf("unable to parse memberlist log message: %s", in)
}
switch string(res[2]) {
case "ERR", "ERROR":
l.logrus.Error(string(res[3]))
case "WARN", "WARNING":
l.logrus.Warn(string(res[3]))
case "DEBUG":
l.logrus.Debug(string(res[3]))
case "INFO":
l.logrus.Info(string(res[3]))
default:
l.logrus.Warnf("unable to parse memberlist log level from message: %s", in)
}
return len(in), nil
}
you can insert in the config using
cfg.LogOutput = newLogParser(logrus)
from memberlist.
any update?
from memberlist.
Related Issues (20)
- Node pointer passed to NodeJoin channel event delegate has no meta HOT 1
- Failed ping error running inside container
- Too many pending push/pull requests
- DATA RACE in invokeAckHandler
- How to detect and react to TCP only failures
- release new version HOT 2
- Feature request: Update state of node in memberlist
- MacOS arm64 support
- Data race in memberlist.go
- Is there a way to retrieve the member list without joining?
- "No private IP address found" error throwed on MacOS
- Is there any interface can I know when the cluster states got converged. HOT 1
- Question/Help: Anything need to be taken into consideration when implement a customize Transport with grpc
- Is it feasible to reuse the gassip port for grpc service? HOT 1
- `Join` with context cancelation
- Checking the state of the Node in NotifyLeave
- Can nodes be identify each MEMBERLIST without using UDP connections?
- memberlist fails in large-scale clusters HOT 1
- suggestion for supporting docker udp
- Data race in state.go:1135 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memberlist.