Giter Site home page Giter Site logo

写文件log,按天记录 about logrus_mate HOT 6 CLOSED

gogap avatar gogap commented on August 17, 2024
写文件log,按天记录

from logrus_mate.

Comments (6)

xujinzheng avatar xujinzheng commented on August 17, 2024

hooks/file 这个也是写文件log,按天记录的,你可以看看是否满足你需求

建议你是写hook,而不是写一个 writer, 因为 hook 能支持较为复杂的逻辑

from logrus_mate.

dimkua avatar dimkua commented on August 17, 2024

loggers的配置如下:
{ "name": "logger", "config": { "development": { "out": { "name": "stdout", "options": {} }, "level": "debug", "formatter": { "name": "json" }, "hooks": [ { "name": "file", "options": { "filename": "1.log", "maxlines": 1000, "maxsize": 1024, "daily": true, "maxdays": 7, "rotate": true, "level": 3 } } ] } } }

hooks/file配置怎么额外有个level,没使用全局的level?
另外1.log记录的日志没使用定义的json格式
[-] 2016/05/31 13:35:44 [ERROR] 111 /home/wjb/Document/go/src/repo.gokuai.cn/gokuai/webhook/logger/logger.go:57 [-] 2016/05/31 13:35:44 [INFO] 222 /home/wjb/Document/go/src/repo.gokuai.cn/gokuai/webhook/logger/logger.go:41

from logrus_mate.

xujinzheng avatar xujinzheng commented on August 17, 2024

这个是指 file 这个插件在什么级别以上才输出,因为 logrus 本身是支持多插件执行的,那么插件本身可以做level的判断

from logrus_mate.

dimkua avatar dimkua commented on August 17, 2024

恩,看到其它几个hook没有level,file有感觉奇怪
file的输出格式不是json,这个是什么原因?

from logrus_mate.

xujinzheng avatar xujinzheng commented on August 17, 2024

这个插件是别人移植的,本身只支持行格式的,比较简易,但是够用

from logrus_mate.

dimkua avatar dimkua commented on August 17, 2024

好吧,我再实现个hook好了

from logrus_mate.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.