Git Product home page Git Product logo

Comments (7)

pya789 avatar pya789 commented on August 18, 2024 1

是指旧文件也有一样的日志行吗?

不,意思是在日期改变后,会先在锁定的文件内输出才会建立新的文件把旧文件旋转。
比如今天是2月1号,输出一条2月1号打印的日志后才会把1月31号的文件旋转导致这条2月1号输出的日志显示在1月31号的文件里

from slog.

inhere avatar inhere commented on August 18, 2024

是指旧文件也有一样的日志行吗?

from slog.

inhere avatar inhere commented on August 18, 2024

:) 哦 。。。 是先写了文件再处理的旋转。

有几行应该也没啥影响吧。我在写入之前处理旋转,也可能造成1月31日的到2月1号的文件里

from slog.

pya789 avatar pya789 commented on August 18, 2024

这个影响不大。还有是这个是1月31号的文件但旋转后是2月1日 虽然可以理解为旋转执行时间但感觉上是有点别扭emmm。。。另外旋转时也不会处理maxSize切割或压缩后的文件。。有点尴尬。serilog那种以日期为文件名的解决方案好像好一点这样可以根据文件名一起压缩

from slog.

inhere avatar inhere commented on August 18, 2024

这个影响不大。还有是这个是1月31号的文件但旋转后是2月1日 虽然可以理解为旋转执行时间但感觉上是有点别扭emmm。。。另外旋转时也不会处理maxSize切割或压缩后的文件。。有点尴尬。serilog那种以日期为文件名的解决方案好像好一点这样可以根据文件名一起压缩

以日期为文件名的解决方案 - 是指创建文件时就按规则创建吗

from slog.

pya789 avatar pya789 commented on August 18, 2024

这个影响不大。还有是这个是1月31号的文件但旋转后是2月1日 虽然可以理解为旋转执行时间但感觉上是有点别扭emmm。。。另外旋转时也不会处理maxSize切割或压缩后的文件。。有点尴尬。serilog那种以日期为文件名的解决方案好像好一点这样可以根据文件名一起压缩

以日期为文件名的解决方案 - 是指创建文件时就按规则创建吗

是的,例如输入path时直接留空logs/info/.log如果留空就直接输出20230201.log这种文件 切割时可以20230201.log.0001 时间变化开始旋转时可以将所有base为20230201的全部压缩成一个包 再删除多余的文件 生成新的20230202.log 当然我只是一个建议...因为感觉现在这个情况时间旋转和切割契合的很不好0.0

from slog.

inhere avatar inhere commented on August 18, 2024

发了 v0.5.2 旋转文件新增了模式:

// eg: 
handler.WithRotateMode(rotatefile.ModeCreate)

设置为 ModeCreate 模式时,配置 logfile 为 /path/error.log, 实际不会创建这个文件,会按照实际分割时间来创建:

/path/error.log.20230618_1500
/path/error.log.20230618_1600
/path/error.log.20230618_1700
...

from slog.

Related Issues (20)

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.