'Is it possible to log to different location for different kind of logs using log4go?

I noticed log4go has the filter mechanism. But it's based on level. That is, logs above certain level goes to certain filter. What I want to achieve is, for example, we have two types of logs, sheep and goat, each with all the levels DEBUG, INFO etc, log of type sheep go to sheep.log, log of type goat goes to goat.log. Is it possible using log4go?



Solution 1:[1]

Not directly, since the Filter struct which is set by AddFilter(name string, lvl Level, writer LogWriter) only filters on the log level, without consideration of "type".

You would have to extend that filter in order to add the "type".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC