I'd like to use different directories for different connections. Let's say I have connections that are being handled in separate threads/goroutines. I want them to write to different log directories. I can specify -log_dir
, but it will write to only one directory, so it's really hard to understand which log file is for.
Is there a way to do something like that using glog
or another package?
As per my knowledge, you may have to create separate logger instances (for each goroutine) to write logs to different directories within different goroutines. Lumberjack would help in this scenario. Its a log rolling package for Go.