dongpaocuan7498 2016-07-17 23:55
浏览 46
已采纳

是否有GoLang记录器,它允许以不同的格式记录到控制台以及日志文件中[关闭]

I come from a node.js background and am comfortable with a number of loggers (such as winston) that allow configurable formatted output to multiple sources such as the console as well as a log file, where the outputs to each may be formatted differently.

I am attempting to do something similar with GoLang and have had difficulty finding a logging package that supports this capability.

Is there a GoLang package that I could use to achieve this outcome?

  • 写回答

3条回答 默认 最新

  • dream890110 2016-07-18 19:27
    关注

    logrus is already mentioned here and it can give you exactly what you need using hooks. Hooks can send the log to different destinations, using different formats. You can find a list of hooks in the documentation like for sending logs to InfluxDB or Logstash. You can even implement your own hook based on your needs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示