Log level when using Serf as a library

48 views
Skip to first unread message

Anthony Lapenna

unread,
Dec 7, 2017, 4:12:08 PM12/7/17
to Serf
Hey all,

Just started using Serf as a library, looks pretty good ! One question I have tho: how can I tune the the logs outputted by the Serf library ? I can see a lot of DEBUG messages and I like to filter these.

Cheers !

Anthony Lapenna

unread,
Dec 8, 2017, 4:52:05 AM12/8/17
to Serf
Figured it out ! 

For those experiencing the same issue, I had to create a LevelFilter and apply it to the Serf & Memberlist configuration:

filter := &logutils.LevelFilter{
  Levels:   []logutils.LogLevel{"DEBUG", "INFO", "WARN", "ERROR"},
  MinLevel: logutils.LogLevel("INFO"),
  Writer:   os.Stderr,
}

conf := serf.DefaultConfig()
conf.Init()
conf.LogOutput = filter
conf.MemberlistConfig.LogOutput = filter

Hope that can help others ! Cheers and great work on Serf !
Reply all
Reply to author
Forward
0 new messages