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 CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ # 3.0.0
3
+
4
+ - Update deps
5
+ - Windows behavior fix
6
+
2
7
  # 2.7.0
3
8
 
4
9
  - [#129] fix overwrite logs in cluster mode (@EllieSummer)
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 = JSON.parse(conf.compress) || false; // Do not compress by default
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 = JSON.parse(conf.rotateModule) || true;
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 = file.substr(0, file.length - 4).split('/').pop() + "__";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pm2-logrotate",
3
- "version": "2.7.0",
3
+ "version": "3.0.0",
4
4
  "description": "Module to rotate logs of every pm2 application",
5
5
  "main": "app.js",
6
6
  "dependencies": {
package/test/echo.js ADDED
@@ -0,0 +1,4 @@
1
+
2
+ setInterval(() => {
3
+ console.log('test line')
4
+ }, 2000)
package/pres/logo.png DELETED
Binary file