简体   繁体   English

温斯顿轮换日志文件名包括当天的日期

[英]winston rotating log file name includes date of the day

I want to create a rotating log file whose name includes the date of the file.我想创建一个名称包含文件日期的旋转日志文件。

For example: 25052021-frontendlogs.txt例如:25052021-frontendlogs.txt

My application does not restart each day.我的应用程序并非每天都重新启动。 So programmaticaly naming of the file is not possible.因此,无法以编程方式命名文件。

winston-daily-rotate-file package only supports %DATE% environment variable in file name. winston-daily-rotate-file package 仅支持文件名中的 %DATE% 环境变量。 Output of the %DATE% is 25-05-2021, there are some "-" in this output that i don't want so i can create a file "25-05-2021-frontendlogs.txt". %DATE% 的 Output 是 25-05-2021,这个 output 中有一些“-”是我不想要的,所以我可以创建一个文件“25-05-2021-frontendlogs.txt”。 How can i format the file name as "25052021-frontendlogs.txt"如何将文件名格式化为“25052021-frontendlogs.txt”

Thanks谢谢

 let DATE = "20-05-2021"; DATE = DATE.replace(/-/g, ''); console.log(DATE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM