@zappinginc/zm2 6.0.15 → 6.0.17

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.
Files changed (3) hide show
  1. package/lib/Utility.js +11 -18
  2. package/lib/motd +7 -12
  3. package/package.json +1 -1
package/lib/Utility.js CHANGED
@@ -11,7 +11,6 @@
11
11
  var fclone = require('fclone');
12
12
  var fs = require('fs');
13
13
  var dgram = require('dgram');
14
- var os = require('os');
15
14
  var cst = require('../constants.js');
16
15
  var waterfall = require('async/waterfall');
17
16
  var util = require('util');
@@ -31,18 +30,10 @@ var SYSLOG_SEVERITY = {
31
30
  var SYSLOG_FACILITY_USER = 1;
32
31
 
33
32
  /**
34
- * Resolve the syslog unix socket path based on platform
35
- */
36
- function getSyslogSocketPath() {
37
- if (os.platform() === 'darwin')
38
- return '/var/run/syslog';
39
- return '/dev/log';
40
- }
41
-
42
- /**
43
- * SyslogStream - A writable stream that sends messages to syslog via unix socket.
33
+ * SyslogStream - A writable stream that sends messages to syslog via UDP.
34
+ * Sends RFC 3164 formatted messages to 127.0.0.1:514.
44
35
  * Implements the same interface as fs.WriteStream so it can be used as a drop-in
45
- * replacement in PM2's logging pipeline.
36
+ * replacement in ZM2's logging pipeline.
46
37
  *
47
38
  * @param {string} appName - Application name for syslog tag
48
39
  * @param {number} pid - Process ID
@@ -50,7 +41,7 @@ function getSyslogSocketPath() {
50
41
  * @param {string} filePath - Original file path (stored as _file for reload compatibility)
51
42
  */
52
43
  function SyslogStream(appName, pid, type, filePath) {
53
- this._appName = appName || 'pm2';
44
+ this._appName = appName || 'zm2';
54
45
  this._pid = pid || process.pid;
55
46
  this._type = type || 'out';
56
47
  this._file = filePath;
@@ -59,16 +50,18 @@ function SyslogStream(appName, pid, type, filePath) {
59
50
  var severity = SYSLOG_SEVERITY[this._type] || 6;
60
51
  this._priority = SYSLOG_FACILITY_USER * 8 + severity;
61
52
 
62
- this._socketPath = getSyslogSocketPath();
53
+ this._syslogPort = parseInt(process.env.ZM2_SYSLOG_PORT) || 514;
54
+ this._syslogHost = process.env.ZM2_SYSLOG_HOST || '127.0.0.1';
63
55
  this._socket = null;
64
56
 
65
57
  try {
66
- this._socket = dgram.createSocket('unix_dgram');
58
+ this._socket = dgram.createSocket('udp4');
59
+ this._socket.unref();
67
60
  this._socket.on('error', function(err) {
68
- console.error('PM2 syslog socket error:', err.message);
61
+ console.error('ZM2 syslog socket error:', err.message);
69
62
  });
70
63
  } catch (e) {
71
- console.error('PM2 syslog: failed to create unix_dgram socket:', e.message);
64
+ console.error('ZM2 syslog: failed to create UDP socket:', e.message);
72
65
  }
73
66
  }
74
67
 
@@ -86,7 +79,7 @@ SyslogStream.prototype.write = function(data, encoding, cb) {
86
79
  var buf = Buffer.from(msg);
87
80
 
88
81
  try {
89
- this._socket.send(buf, 0, buf.length, this._socketPath);
82
+ this._socket.send(buf, 0, buf.length, this._syslogPort, this._syslogHost);
90
83
  } catch (e) {
91
84
  // Socket may be unavailable; swallow error to avoid crashing the app
92
85
  }
package/lib/motd CHANGED
@@ -1,15 +1,13 @@
1
1
 
2
2
  -------------
3
3
 
4
- __/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
5
- _\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
6
- _\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
7
- _\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
8
- _\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
9
- _\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
10
- _\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
11
- _\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
12
- _\///______________\///______________\///__\///////////////__
4
+ ________ ___ ___ ________
5
+ |\_____ \|\ \ / /| |\_____ \
6
+ \|___/ /\ \ \ / / / \|___/ /
7
+ / / /\ \ \/ / / / / /
8
+ / /_/__\ \ / / / /_/__
9
+ |\________\ \__/ / |\________\
10
+ \|_______|\|__|/ \|_______|
13
11
 
14
12
 
15
13
  Runtime Edition
@@ -29,8 +27,5 @@ __/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
29
27
  Make zm2 auto-boot at server restart:
30
28
  $ zm2 startup
31
29
 
32
- To go further checkout:
33
- http://pm2.io/
34
-
35
30
 
36
31
  -------------
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zappinginc/zm2",
3
3
  "preferGlobal": true,
4
- "version": "6.0.15",
4
+ "version": "6.0.17",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
7
7
  },