diff --git a/README.md b/README.md index 8624407..f2b7256 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ create formatted messages or use directly **RFC3164** ```js let rfc3164 = new SyslogPro.RFC3164({ - applacationName: 'MyApp', + applicationName: 'MyApp', color: true, extendedColor: true, server: { @@ -63,9 +63,9 @@ create formatted messages or use directly **RFC5424** ```js let rfc5424 = new SyslogPro.RFC5424({ - applacationName: 'MyApp', + applicationName: 'MyApp', timestamp: true, - encludeStructuredData: true + includeStructuredData: true color: true, extendedColor: true, server: { diff --git a/docs/api.md b/docs/api.md index 9d4ec74..fdd1cc0 100644 --- a/docs/api.md +++ b/docs/api.md @@ -65,7 +65,7 @@ formatting classes so that they may run independently. * [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : boolean * [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : boolean * [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : boolean - * [.encludeStructuredData](#module_SyslogPro..RFC5424+encludeStructuredData) : boolean + * [.includeStructuredData](#module_SyslogPro..RFC5424+includeStructuredData) : boolean * [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : boolean * [.color](#module_SyslogPro..RFC5424+color) : boolean * [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : boolean @@ -263,7 +263,7 @@ Construct a new RFC3164 formatted Syslog object with user options | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | Options object | -| [options.applacationName] | string | "'NodeJSLogger'" | Application | +| [options.applicationName] | string | "'NodeJSLogger'" | Application | | [options.hostname] | string | "os.hostname" | The name of this server | | [options.facility] | number | 23 | Facility code to use sending this message | | [options.color] | boolean | false | Apply color coding encoding tag with syslog message text | @@ -636,7 +636,7 @@ fashion where new messages are written to the class as needed. * [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : boolean * [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : boolean * [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : boolean - * [.encludeStructuredData](#module_SyslogPro..RFC5424+encludeStructuredData) : boolean + * [.includeStructuredData](#module_SyslogPro..RFC5424+includeStructuredData) : boolean * [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : boolean * [.color](#module_SyslogPro..RFC5424+color) : boolean * [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : boolean @@ -668,13 +668,13 @@ Construct a new RFC5424 formatted Syslog object with user options | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | object | | Options object | -| [options.applacationName] | string | "'NodeJSLogger'" | Application | +| [options.applicationName] | string | "'NodeJSLogger'" | Application | | [options.hostname] | string | "os.hostname" | The name of this server | | [options.timestamp] | boolean | false | Included a Timestamp | | [options.timestampUTC] | boolean | false | RFC standard is for local time | | [options.timestampMS] | boolean | false | Timestamp with ms resolution | | [options.timestampTZ] | boolean | true | Should the timestamp included time zone | -| [options.encludeStructuredData] | boolean | false | Included any provided structured data | +| [options.includeStructuredData] | boolean | false | Included any provided structured data | | [options.utf8BOM] | boolean | true | Included the UTF8 | | [options.color] | boolean | false | Included the UTF8 | | [options.extendedColor] | boolean | false | Included the UTF8 encoding tag with syslog message text | @@ -705,9 +705,9 @@ Construct a new RFC5424 formatted Syslog object with user options #### rfC5424.timestampMS : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) - + -#### rfC5424.encludeStructuredData : boolean +#### rfC5424.includeStructuredData : boolean **Kind**: instance property of [RFC5424](#module_SyslogPro..RFC5424) diff --git a/docs/docco/README.md b/docs/docco/README.md index 11bd0b2..6b064e5 100644 --- a/docs/docco/README.md +++ b/docs/docco/README.md @@ -624,7 +624,7 @@ class RFC3164 { * @public * @this RFC3164 * @param {object} [options] - Options object - * @param {string} [options.applacationName='NodeJSLogger'] - Application + * @param {string} [options.applicationName='NodeJSLogger'] - Application * @param {string} [options.hostname=os.hostname] - The name of this server * @param {number} [options.facility=23] - Facility code to use sending this * message @@ -667,7 +667,7 @@ class RFC3164 { this.constructor__ = true; options = options || {}; this.hostname = options.hostname || os.hostname(); - this.applacationName = options.applacationName || ''; + this.applicationName = options.applicationName || ''; this.facility = options.facility || 23; if (options.color) { /** @type {boolean} */ @@ -1016,7 +1016,7 @@ Build message fmtMsg = '<' + pri + '>'; fmtMsg += timestamp; fmtMsg += ' ' + this.hostname; - fmtMsg += ' ' + this.applacationName; + fmtMsg += ' ' + this.applicationName; fmtMsg += ' ' + msg; fmtMsg += newLine; resolve(fmtMsg); @@ -1258,7 +1258,7 @@ class RFC5424 { * @public * @this RFC5424 * @param {object} [options] - Options object - * @param {string} [options.applacationName='NodeJSLogger'] - Application + * @param {string} [options.applicationName='NodeJSLogger'] - Application * @param {string} [options.hostname=os.hostname] - The name of this server * @param {boolean} [options.timestamp=false] - Included a Timestamp * @param {boolean} [options.timestampUTC=false] - RFC standard is for @@ -1267,7 +1267,7 @@ class RFC5424 { * resolution * @param {boolean} [options.timestampTZ=true] - Should the timestamp * included time zone - * @param {boolean} [options.encludeStructuredData=false] - Included + * @param {boolean} [options.includeStructuredData=false] - Included * any provided structured data * @param {boolean} [options.utf8BOM=true] - Included the UTF8 * @param {boolean} [options.color=false] - Included the UTF8 @@ -1308,7 +1308,7 @@ class RFC5424 { this.constructor__ = true; options = options || {}; this.hostname = options.hostname || os.hostname(); - this.applacationName = options.applacationName || ''; + this.applicationName = options.applicationName || ''; if (typeof options.timestamp === 'undefined' || options.timestamp) { /** @type {boolean} */ this.timestamp = true; @@ -1333,11 +1333,11 @@ class RFC5424 { } else { this.timestampMS = false; } - if (options.encludeStructuredData) { + if (options.includeStructuredData) { /** @type {boolean} */ - this.encludeStructuredData = true; + this.includeStructuredData = true; } else { - this.encludeStructuredData = false; + this.includeStructuredData = false; } if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) { /** @type {boolean} */ @@ -1740,7 +1740,7 @@ Build Structured Data string ``` let structuredData = '-'; const sdElementCount = msgStructuredData.length; - if (this.encludeStructuredData && sdElementCount > 0) { + if (this.includeStructuredData && sdElementCount > 0) { let sdElementNames = []; let sdElements = []; const sdElementNameRegEx = /(\[)(\S*)(\s|\])/; @@ -1791,7 +1791,7 @@ Build the message fmtMsg += '1'; // Version number fmtMsg += ' ' + timestamp; fmtMsg += ' ' + this.hostname; - fmtMsg += ' ' + this.applacationName; + fmtMsg += ' ' + this.applicationName; fmtMsg += ' ' + pid; fmtMsg += ' ' + id; fmtMsg += ' ' + structuredData; diff --git a/docs/docco/index.html b/docs/docco/index.html index 79d0595..e9986e9 100644 --- a/docs/docco/index.html +++ b/docs/docco/index.html @@ -637,7 +637,7 @@ * @public * @this RFC3164 * @param {object} [options] - Options object - * @param {string} [options.applacationName='NodeJSLogger'] - Application + * @param {string} [options.applicationName='NodeJSLogger'] - Application * @param {string} [options.hostname=os.hostname] - The name of this server * @param {number} [options.facility=23] - Facility code to use sending this * message @@ -680,7 +680,7 @@ this.constructor__ = true; options = options || {}; this.hostname = options.hostname || os.hostname(); - this.applacationName = options.applacationName || ''; + this.applicationName = options.applicationName || ''; this.facility = options.facility || 23; if (options.color) { /** @type {boolean} */ @@ -1024,7 +1024,7 @@ uses BSD timeformat

      fmtMsg = '<' + pri + '>';
       fmtMsg += timestamp;
       fmtMsg += ' ' + this.hostname;
-      fmtMsg += ' ' + this.applacationName;
+      fmtMsg += ' ' + this.applicationName;
       fmtMsg += ' ' + msg;
       fmtMsg += newLine;
       resolve(fmtMsg);
@@ -1266,7 +1266,7 @@ uses BSD timeformat

* @public * @this RFC5424 * @param {object} [options] - Options object - * @param {string} [options.applacationName='NodeJSLogger'] - Application + * @param {string} [options.applicationName='NodeJSLogger'] - Application * @param {string} [options.hostname=os.hostname] - The name of this server * @param {boolean} [options.timestamp=false] - Included a Timestamp * @param {boolean} [options.timestampUTC=false] - RFC standard is for @@ -1275,7 +1275,7 @@ uses BSD timeformat

* resolution * @param {boolean} [options.timestampTZ=true] - Should the timestamp * included time zone - * @param {boolean} [options.encludeStructuredData=false] - Included + * @param {boolean} [options.includeStructuredData=false] - Included * any provided structured data * @param {boolean} [options.utf8BOM=true] - Included the UTF8 * @param {boolean} [options.color=false] - Included the UTF8 @@ -1316,7 +1316,7 @@ uses BSD timeformat

this.constructor__ = true; options = options || {}; this.hostname = options.hostname || os.hostname(); - this.applacationName = options.applacationName || ''; + this.applicationName = options.applicationName || ''; if (typeof options.timestamp === 'undefined' || options.timestamp) { /** @type {boolean} */ this.timestamp = true; @@ -1341,11 +1341,11 @@ uses BSD timeformat

} else { this.timestampMS = false; } - if (options.encludeStructuredData) { + if (options.includeStructuredData) { /** @type {boolean} */ - this.encludeStructuredData = true; + this.includeStructuredData = true; } else { - this.encludeStructuredData = false; + this.includeStructuredData = false; } if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) { /** @type {boolean} */ @@ -1743,7 +1743,7 @@ uses BSD timeformat

      let structuredData = '-';
       const sdElementCount = msgStructuredData.length;
-      if (this.encludeStructuredData && sdElementCount > 0) {
+      if (this.includeStructuredData && sdElementCount > 0) {
         let sdElementNames = [];
         let sdElements = [];
         const sdElementNameRegEx = /(\[)(\S*)(\s|\])/;
@@ -1792,7 +1792,7 @@ uses BSD timeformat

fmtMsg += '1'; // Version number fmtMsg += ' ' + timestamp; fmtMsg += ' ' + this.hostname; - fmtMsg += ' ' + this.applacationName; + fmtMsg += ' ' + this.applicationName; fmtMsg += ' ' + pid; fmtMsg += ' ' + id; fmtMsg += ' ' + structuredData; diff --git a/docs/index.html b/docs/index.html index 816d987..bf8eca7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -85,7 +85,7 @@ and the DNS Promi create formatted messages or use directly

RFC3164

  let rfc3164 = new SyslogPro.RFC3164({
-    applacationName: 'MyApp',
+    applicationName: 'MyApp',
     color: true,
     extendedColor: true,
     server: {
@@ -94,9 +94,9 @@ create formatted messages or use directly

}); rfc3164.info('My Message');

RFC5424

  let rfc5424 = new SyslogPro.RFC5424({
-    applacationName: 'MyApp',
+    applicationName: 'MyApp',
     timestamp: true,
-    encludeStructuredData: true
+    includeStructuredData: true
     color: true,
     extendedColor: true,
     server: {
diff --git a/docs/index.js.html b/docs/index.js.html
index 9f713f4..2818a26 100644
--- a/docs/index.js.html
+++ b/docs/index.js.html
@@ -518,7 +518,7 @@ class RFC3164 {
    * @public
    * @this RFC3164
    * @param {object} [options] - Options object
-   * @param {string} [options.applacationName='NodeJSLogger'] - Application
+   * @param {string} [options.applicationName='NodeJSLogger'] - Application
    * @param {string} [options.hostname=os.hostname] - The name of this server
    * @param {number} [options.facility=23] - Facility code to use sending this
    *    message
@@ -561,7 +561,7 @@ class RFC3164 {
     this.constructor__ = true;
     options = options || {};
     this.hostname = options.hostname || os.hostname();
-    this.applacationName = options.applacationName || '';
+    this.applicationName = options.applicationName || '';
     this.facility = options.facility || 23;
     if (options.color) {
       /** @type {boolean} */
@@ -840,7 +840,7 @@ class RFC3164 {
       fmtMsg = '<' + pri + '>';
       fmtMsg += timestamp;
       fmtMsg += ' ' + this.hostname;
-      fmtMsg += ' ' + this.applacationName;
+      fmtMsg += ' ' + this.applicationName;
       fmtMsg += ' ' + msg;
       fmtMsg += newLine;
       resolve(fmtMsg);
@@ -1082,7 +1082,7 @@ class RFC5424 {
    * @public
    * @this RFC5424
    * @param {object} [options] - Options object
-   * @param {string} [options.applacationName='NodeJSLogger'] - Application
+   * @param {string} [options.applicationName='NodeJSLogger'] - Application
    * @param {string} [options.hostname=os.hostname] - The name of this server
    * @param {boolean} [options.timestamp=false] - Included a Timestamp
    * @param {boolean} [options.timestampUTC=false] - RFC standard is for
@@ -1091,7 +1091,7 @@ class RFC5424 {
    *    resolution
    * @param {boolean} [options.timestampTZ=true] - Should the timestamp
    *    included time zone
-   * @param {boolean} [options.encludeStructuredData=false] - Included
+   * @param {boolean} [options.includeStructuredData=false] - Included
    *    any provided structured data
    * @param {boolean} [options.utf8BOM=true] - Included the UTF8
    * @param {boolean} [options.color=false] - Included the UTF8
@@ -1132,7 +1132,7 @@ class RFC5424 {
     this.constructor__ = true;
     options = options || {};
     this.hostname = options.hostname || os.hostname();
-    this.applacationName = options.applacationName || '';
+    this.applicationName = options.applicationName || '';
     if (typeof options.timestamp === 'undefined' || options.timestamp) {
       /** @type {boolean} */
       this.timestamp = true;
@@ -1157,11 +1157,11 @@ class RFC5424 {
     } else {
       this.timestampMS = false;
     }
-    if (options.encludeStructuredData) {
+    if (options.includeStructuredData) {
       /** @type {boolean} */
-      this.encludeStructuredData = true;
+      this.includeStructuredData = true;
     } else {
-      this.encludeStructuredData = false;
+      this.includeStructuredData = false;
     }
     if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) {
       /** @type {boolean} */
@@ -1494,7 +1494,7 @@ class RFC5424 {
       // Build Structured Data string
       let structuredData = '-';
       const sdElementCount = msgStructuredData.length;
-      if (this.encludeStructuredData && sdElementCount > 0) {
+      if (this.includeStructuredData && sdElementCount > 0) {
         let sdElementNames = [];
         let sdElements = [];
         const sdElementNameRegEx = /(\[)(\S*)(\s|\])/;
@@ -1517,7 +1517,7 @@ class RFC5424 {
       fmtMsg += '1'; // Version number
       fmtMsg += ' ' + timestamp;
       fmtMsg += ' ' + this.hostname;
-      fmtMsg += ' ' + this.applacationName;
+      fmtMsg += ' ' + this.applicationName;
       fmtMsg += ' ' + pid;
       fmtMsg += ' ' + id;
       fmtMsg += ' ' + structuredData;
diff --git a/docs/module-SyslogPro-RFC3164.html b/docs/module-SyslogPro-RFC3164.html
index 06ba0aa..fbb3a0a 100644
--- a/docs/module-SyslogPro-RFC3164.html
+++ b/docs/module-SyslogPro-RFC3164.html
@@ -229,7 +229,7 @@ fashion where new messages are written to the class as needed.
- applacationName + applicationName diff --git a/docs/module-SyslogPro-RFC5424.html b/docs/module-SyslogPro-RFC5424.html index 14c9809..da2d86c 100644 --- a/docs/module-SyslogPro-RFC5424.html +++ b/docs/module-SyslogPro-RFC5424.html @@ -230,7 +230,7 @@ fashion where new messages are written to the class as needed.
- applacationName + applicationName @@ -467,7 +467,7 @@ fashion where new messages are written to the class as needed. - encludeStructuredData + includeStructuredData @@ -1427,7 +1427,7 @@ fashion where new messages are written to the class as needed. -

encludeStructuredData :boolean

+

includeStructuredData :boolean

diff --git a/index.js b/index.js index fb2c443..8368146 100644 --- a/index.js +++ b/index.js @@ -475,7 +475,7 @@ class RFC3164 { * @public * @this RFC3164 * @param {object} [options] - Options object - * @param {string} [options.applacationName='NodeJSLogger'] - Application + * @param {string} [options.applicationName='NodeJSLogger'] - Application * @param {string} [options.hostname=os.hostname] - The name of this server * @param {number} [options.facility=23] - Facility code to use sending this * message @@ -518,7 +518,11 @@ class RFC3164 { this.constructor__ = true; options = options || {}; this.hostname = options.hostname || os.hostname(); - this.applacationName = options.applacationName || ''; + if (options.applicationName) { + this.applicationName = options.applicationName; + } else { + this.applicationName = options.applacationName || ''; + } this.facility = options.facility || 23; if (options.color) { /** @type {boolean} */ @@ -797,7 +801,7 @@ class RFC3164 { fmtMsg = '<' + pri + '>'; fmtMsg += timestamp; fmtMsg += ' ' + this.hostname; - fmtMsg += ' ' + this.applacationName; + fmtMsg += ' ' + this.applicationName; fmtMsg += ' ' + msg; fmtMsg += newLine; resolve(fmtMsg); @@ -1039,7 +1043,7 @@ class RFC5424 { * @public * @this RFC5424 * @param {object} [options] - Options object - * @param {string} [options.applacationName='NodeJSLogger'] - Application + * @param {string} [options.applicationName='NodeJSLogger'] - Application * @param {string} [options.hostname=os.hostname] - The name of this server * @param {boolean} [options.timestamp=false] - Included a Timestamp * @param {boolean} [options.timestampUTC=false] - RFC standard is for @@ -1048,7 +1052,7 @@ class RFC5424 { * resolution * @param {boolean} [options.timestampTZ=true] - Should the timestamp * included time zone - * @param {boolean} [options.encludeStructuredData=false] - Included + * @param {boolean} [options.includeStructuredData=false] - Included * any provided structured data * @param {boolean} [options.utf8BOM=true] - Included the UTF8 * @param {boolean} [options.color=false] - Included the UTF8 @@ -1089,7 +1093,11 @@ class RFC5424 { this.constructor__ = true; options = options || {}; this.hostname = options.hostname || os.hostname(); - this.applacationName = options.applacationName || ''; + if (options.applicationName) { + this.applicationName = options.applicationName; + } else { + this.applicationName = options.applacationName || ''; + } if (typeof options.timestamp === 'undefined' || options.timestamp) { /** @type {boolean} */ this.timestamp = true; @@ -1114,11 +1122,11 @@ class RFC5424 { } else { this.timestampMS = false; } - if (options.encludeStructuredData) { + if (options.includeStructuredData || options.encludeStructuredData) { /** @type {boolean} */ - this.encludeStructuredData = true; + this.includeStructuredData = true; } else { - this.encludeStructuredData = false; + this.includeStructuredData = false; } if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) { /** @type {boolean} */ @@ -1451,7 +1459,7 @@ class RFC5424 { // Build Structured Data string let structuredData = '-'; const sdElementCount = msgStructuredData.length; - if (this.encludeStructuredData && sdElementCount > 0) { + if (this.includeStructuredData && sdElementCount > 0) { let sdElementNames = []; let sdElements = []; const sdElementNameRegEx = /(\[)(\S*)(\s|\])/; @@ -1474,7 +1482,7 @@ class RFC5424 { fmtMsg += '1'; // Version number fmtMsg += ' ' + timestamp; fmtMsg += ' ' + this.hostname; - fmtMsg += ' ' + this.applacationName; + fmtMsg += ' ' + this.applicationName; fmtMsg += ' ' + pid; fmtMsg += ' ' + id; fmtMsg += ' ' + structuredData; @@ -3374,4 +3382,3 @@ module.exports = { CEF: CEF, Syslog: Syslog, }; - diff --git a/tests/syslog.test.js b/tests/syslog.test.js index b501396..af590bf 100644 --- a/tests/syslog.test.js +++ b/tests/syslog.test.js @@ -373,7 +373,7 @@ describe('RFC5424 Class Tests', () => { timestampUTC: true, timestampTZ: false, timestampMS: true, - encludeStructuredData: true, + includeStructuredData: true, colors: { emergencyColor: 30, alertColor: 30, @@ -428,7 +428,7 @@ describe('RFC5424 Class Tests', () => { let resultMsg = /<190>1 \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} /; expect(result).toMatch(resultMsg); let rfc5424 = new SyslogPro.RFC5424({ - encludeStructuredData: true, + includeStructuredData: true, color: true, extendedColor: false, timestamp: true,