dtfbj24048 2015-08-06 05:58
浏览 130

是否可以使用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?

  • 写回答

1条回答 默认 最新

  • doujian1954 2015-08-06 08:08
    关注

    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".

    评论

报告相同问题?

悬赏问题

  • ¥15 关于无人驾驶的航向角
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退