pm2-logrotate 2.7.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +4 -0
- package/app.js +9 -3
- package/package.json +1 -1
- package/test/echo.js +4 -0
- package/pres/logo.png +0 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -33,6 +33,10 @@ We are using [node-schedule](https://github.com/node-schedule/node-schedule) to
|
|
|
33
33
|
└───────────────────────── second (0 - 59, OPTIONAL)
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
### How to view current configuration of the above values ?
|
|
37
|
+
After having installed the module, you have to type :
|
|
38
|
+
`pm2 conf`
|
|
39
|
+
|
|
36
40
|
### How to set these values ?
|
|
37
41
|
|
|
38
42
|
After having installed the module you have to type :
|
package/app.js
CHANGED
|
@@ -35,15 +35,21 @@ else if (process.env.HOME && !process.env.HOMEPATH)
|
|
|
35
35
|
else if (process.env.HOME || process.env.HOMEPATH)
|
|
36
36
|
PM2_ROOT_PATH = path.resolve(process.env.HOMEDRIVE, process.env.HOME || process.env.HOMEPATH, '.pm2');
|
|
37
37
|
|
|
38
|
+
const parseBool = (str, defaultVal = false) => {
|
|
39
|
+
if (str === 'true') return true;
|
|
40
|
+
if (str === 'false') return false;
|
|
41
|
+
return defaultVal;
|
|
42
|
+
};
|
|
43
|
+
|
|
38
44
|
var WORKER_INTERVAL = isNaN(parseInt(conf.workerInterval)) ? 30 * 1000 :
|
|
39
45
|
parseInt(conf.workerInterval) * 1000; // default: 30 secs
|
|
40
46
|
var SIZE_LIMIT = get_limit_size(); // default : 10MB
|
|
41
47
|
var ROTATE_CRON = conf.rotateInterval || "0 0 * * *"; // default : every day at midnight
|
|
42
48
|
var RETAIN = isNaN(parseInt(conf.retain)) ? undefined : parseInt(conf.retain); // All
|
|
43
|
-
var COMPRESSION =
|
|
49
|
+
var COMPRESSION = parseBool(conf.compress, false); // Do not compress by default
|
|
44
50
|
var DATE_FORMAT = conf.dateFormat || 'YYYY-MM-DD_HH-mm-ss';
|
|
45
51
|
var TZ = conf.TZ;
|
|
46
|
-
var ROTATE_MODULE =
|
|
52
|
+
var ROTATE_MODULE = parseBool(conf.rotateModule, true);
|
|
47
53
|
var WATCHED_FILES = [];
|
|
48
54
|
|
|
49
55
|
function get_limit_size() {
|
|
@@ -62,7 +68,7 @@ function get_limit_size() {
|
|
|
62
68
|
|
|
63
69
|
function delete_old(file) {
|
|
64
70
|
if (file === "/dev/null") return;
|
|
65
|
-
var fileBaseName =
|
|
71
|
+
var fileBaseName = path.basename(file, '.log') + "__";
|
|
66
72
|
var dirName = path.dirname(file);
|
|
67
73
|
|
|
68
74
|
fs.readdir(dirName, function(err, files) {
|
package/package.json
CHANGED
package/test/echo.js
ADDED
package/pres/logo.png
DELETED
|
Binary file
|