Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我在您的节点的基础上添加了一个新节点,并重构了大部分代码,我的节点名称为node-red-log-to-file(I have added a new node based on your node and refactored most of the code,My node name node-red-log-to-file) #10

Open
qq1746495550 opened this issue Nov 16, 2023 · 0 comments

Comments

@qq1746495550
Copy link

首先谢谢您的贡献,看到您的上次提交记录为4年前,可能不会再维护了,所以我对您的代码进行了重构,修改增加了大量内容
我的节点名称为node-red-log-to-file
功能不同点:以下均基于我的(0.1.1版本)
1、我不再接受任何输入,全部改为手动配置,我会将收到日志按日期直接分割开
最终文件路径统一为: /文件夹地址/yyyy-MM-dd/yyyy-MM-dd_INFO.log
2、节点名称:我会将节点名称(nodeName)带入日志中,方便定位具体的日志位置,例:
{"time":"2023-11-16 15:03:47.340","nodeName":"log-to-file 3","level":"INFO","msg":{"payload":"p","key":"k","_msgid":"4818a213c3e81155"}}
3、日志类型:我移除了胡子格式,我没有看出他的作用
4、日志级别:我将不同日志级别的日志打印到了不同的文件下。而不是同一个文件中。因为在普通的java程序中就是这么分的
5、日志配置:直接将文件夹路径作为日志配置的名字,更加明显
6、定时清理(重要):增加了一个日志定时清理功能。防止生成大量的日志文件占用过多的磁盘空间。
7、日志分片(重要):您的日志分片逻辑引入了其他人的依赖,其中存在严重的错误,我取消了这个依赖require('log-rotate'),并重构了这部分代码

以下是机器翻译

First of all, thank you for your contribution. I noticed that your last submission record was 4 years ago and may no longer be maintained. Therefore, I have refactored your code and added a lot of content to the modifications

My node name node-red-log-to-file

Functional differences: The following are all based on my (version 0.1.1)

  1. I no longer accept any input and will manually configure everything. I will directly split the received logs by date

The final file path is unified as:/folder address/yyyy MM dd/yyyy MM dd_ INFO.log,

  1. Node Name: I will bring the node name (nodeName) into the log to facilitate locating the specific log location, for example:

{"time": "2023-11-16 15:03:47.340", "nodeName": "log to file 3", "level": "INFO", "msg": {"payload": "p", "key": "k", "_msgid": "4818a213c3e81155"}}

  1. Log type: I removed the beard format and did not see its effect

  2. Log level: I have printed logs of different log levels to different files. Not in the same file. Because that's how it's divided in regular Java programs

  3. Log configuration: Directly use the folder path as the name of the log configuration, which is more obvious

  4. Scheduled cleaning (important): Added a log scheduled cleaning function. Prevent generating a large number of log files from taking up too much disk space.

  5. Log sharding (important): Your log sharding logic has introduced a dependency from someone else, which has serious errors. I have removed this dependency require ('log rotate '), and refactored this part of the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant