hashicorp/raft

How to costumize the Logger Name

JoanFM opened this issue · 2 comments

Is there an option that I may have not seen to customize the Logger name?

If this is not yet possible, I think I could make a PR to enable this, would this be interesting to the community?

I am doing some tests and demos where Raft Nodes are run in different processes in the same terminal and I have no way from the logs to tell which Node is giving which log message.

Thanks for everything.

Hello @JoanFM,

You should be able to customize the Logger name by passing a custom logger in the Config:

	lgr := hclog.New(&hclog.LoggerOptions{
		Name:   "custom-name",
		Level:  hclog.LevelFromString("info"),
	})

	conf := raft.DefaultConfig()
	conf.Logger = lgr
	r := raft.NewRaft(conf, ...)

Oh that would be good, thanks!!!