Fix typo includeStructuredData

This commit is contained in:
ajimix 2019-03-22 12:22:20 +08:00
parent 2cb30e652d
commit d1f7ca3e8f
9 changed files with 31 additions and 31 deletions

View File

@ -65,7 +65,7 @@ create formatted messages or use directly
let rfc5424 = new SyslogPro.RFC5424({ let rfc5424 = new SyslogPro.RFC5424({
applicationName: 'MyApp', applicationName: 'MyApp',
timestamp: true, timestamp: true,
encludeStructuredData: true includeStructuredData: true
color: true, color: true,
extendedColor: true, extendedColor: true,
server: { server: {

View File

@ -65,7 +65,7 @@ formatting classes so that they may run independently.
* [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : <code>boolean</code> * [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : <code>boolean</code>
* [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : <code>boolean</code> * [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : <code>boolean</code>
* [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : <code>boolean</code> * [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : <code>boolean</code>
* [.encludeStructuredData](#module_SyslogPro..RFC5424+encludeStructuredData) : <code>boolean</code> * [.includeStructuredData](#module_SyslogPro..RFC5424+includeStructuredData) : <code>boolean</code>
* [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : <code>boolean</code> * [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : <code>boolean</code>
* [.color](#module_SyslogPro..RFC5424+color) : <code>boolean</code> * [.color](#module_SyslogPro..RFC5424+color) : <code>boolean</code>
* [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : <code>boolean</code> * [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : <code>boolean</code>
@ -636,7 +636,7 @@ fashion where new messages are written to the class as needed.
* [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : <code>boolean</code> * [.timestampUTC](#module_SyslogPro..RFC5424+timestampUTC) : <code>boolean</code>
* [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : <code>boolean</code> * [.timestampTZ](#module_SyslogPro..RFC5424+timestampTZ) : <code>boolean</code>
* [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : <code>boolean</code> * [.timestampMS](#module_SyslogPro..RFC5424+timestampMS) : <code>boolean</code>
* [.encludeStructuredData](#module_SyslogPro..RFC5424+encludeStructuredData) : <code>boolean</code> * [.includeStructuredData](#module_SyslogPro..RFC5424+includeStructuredData) : <code>boolean</code>
* [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : <code>boolean</code> * [.utf8BOM](#module_SyslogPro..RFC5424+utf8BOM) : <code>boolean</code>
* [.color](#module_SyslogPro..RFC5424+color) : <code>boolean</code> * [.color](#module_SyslogPro..RFC5424+color) : <code>boolean</code>
* [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : <code>boolean</code> * [.extendedColor](#module_SyslogPro..RFC5424+extendedColor) : <code>boolean</code>
@ -674,7 +674,7 @@ Construct a new RFC5424 formatted Syslog object with user options
| [options.timestampUTC] | <code>boolean</code> | <code>false</code> | RFC standard is for local time | | [options.timestampUTC] | <code>boolean</code> | <code>false</code> | RFC standard is for local time |
| [options.timestampMS] | <code>boolean</code> | <code>false</code> | Timestamp with ms resolution | | [options.timestampMS] | <code>boolean</code> | <code>false</code> | Timestamp with ms resolution |
| [options.timestampTZ] | <code>boolean</code> | <code>true</code> | Should the timestamp included time zone | | [options.timestampTZ] | <code>boolean</code> | <code>true</code> | Should the timestamp included time zone |
| [options.encludeStructuredData] | <code>boolean</code> | <code>false</code> | Included any provided structured data | | [options.includeStructuredData] | <code>boolean</code> | <code>false</code> | Included any provided structured data |
| [options.utf8BOM] | <code>boolean</code> | <code>true</code> | Included the UTF8 | | [options.utf8BOM] | <code>boolean</code> | <code>true</code> | Included the UTF8 |
| [options.color] | <code>boolean</code> | <code>false</code> | Included the UTF8 | | [options.color] | <code>boolean</code> | <code>false</code> | Included the UTF8 |
| [options.extendedColor] | <code>boolean</code> | <code>false</code> | Included the UTF8 encoding tag with syslog message text | | [options.extendedColor] | <code>boolean</code> | <code>false</code> | 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 : <code>boolean</code> #### rfC5424.timestampMS : <code>boolean</code>
**Kind**: instance property of [<code>RFC5424</code>](#module_SyslogPro..RFC5424) **Kind**: instance property of [<code>RFC5424</code>](#module_SyslogPro..RFC5424)
<a name="module_SyslogPro..RFC5424+encludeStructuredData"></a> <a name="module_SyslogPro..RFC5424+includeStructuredData"></a>
#### rfC5424.encludeStructuredData : <code>boolean</code> #### rfC5424.includeStructuredData : <code>boolean</code>
**Kind**: instance property of [<code>RFC5424</code>](#module_SyslogPro..RFC5424) **Kind**: instance property of [<code>RFC5424</code>](#module_SyslogPro..RFC5424)
<a name="module_SyslogPro..RFC5424+utf8BOM"></a> <a name="module_SyslogPro..RFC5424+utf8BOM"></a>

View File

@ -1267,7 +1267,7 @@ class RFC5424 {
* resolution * resolution
* @param {boolean} [options.timestampTZ=true] - Should the timestamp * @param {boolean} [options.timestampTZ=true] - Should the timestamp
* included time zone * included time zone
* @param {boolean} [options.encludeStructuredData=false] - Included * @param {boolean} [options.includeStructuredData=false] - Included
* any provided structured data * any provided structured data
* @param {boolean} [options.utf8BOM=true] - Included the UTF8 * @param {boolean} [options.utf8BOM=true] - Included the UTF8
* @param {boolean} [options.color=false] - Included the UTF8 * @param {boolean} [options.color=false] - Included the UTF8
@ -1333,11 +1333,11 @@ class RFC5424 {
} else { } else {
this.timestampMS = false; this.timestampMS = false;
} }
if (options.encludeStructuredData) { if (options.includeStructuredData) {
/** @type {boolean} */ /** @type {boolean} */
this.encludeStructuredData = true; this.includeStructuredData = true;
} else { } else {
this.encludeStructuredData = false; this.includeStructuredData = false;
} }
if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) { if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) {
/** @type {boolean} */ /** @type {boolean} */
@ -1740,7 +1740,7 @@ Build Structured Data string
``` ```
let structuredData = '-'; let structuredData = '-';
const sdElementCount = msgStructuredData.length; const sdElementCount = msgStructuredData.length;
if (this.encludeStructuredData && sdElementCount > 0) { if (this.includeStructuredData && sdElementCount > 0) {
let sdElementNames = []; let sdElementNames = [];
let sdElements = []; let sdElements = [];
const sdElementNameRegEx = /(\[)(\S*)(\s|\])/; const sdElementNameRegEx = /(\[)(\S*)(\s|\])/;

View File

@ -1275,7 +1275,7 @@ uses BSD timeformat</p>
* resolution * resolution
* @param {boolean} [options.timestampTZ=true] - Should the timestamp * @param {boolean} [options.timestampTZ=true] - Should the timestamp
* included time zone * included time zone
* @param {boolean} [options.encludeStructuredData=false] - Included * @param {boolean} [options.includeStructuredData=false] - Included
* any provided structured data * any provided structured data
* @param {boolean} [options.utf8BOM=true] - Included the UTF8 * @param {boolean} [options.utf8BOM=true] - Included the UTF8
* @param {boolean} [options.color=false] - Included the UTF8 * @param {boolean} [options.color=false] - Included the UTF8
@ -1341,11 +1341,11 @@ uses BSD timeformat</p>
} <span class="hljs-keyword">else</span> { } <span class="hljs-keyword">else</span> {
<span class="hljs-keyword">this</span>.timestampMS = <span class="hljs-literal">false</span>; <span class="hljs-keyword">this</span>.timestampMS = <span class="hljs-literal">false</span>;
} }
<span class="hljs-keyword">if</span> (options.encludeStructuredData) { <span class="hljs-keyword">if</span> (options.includeStructuredData) {
<span class="hljs-comment">/** @type {boolean} */</span> <span class="hljs-comment">/** @type {boolean} */</span>
<span class="hljs-keyword">this</span>.encludeStructuredData = <span class="hljs-literal">true</span>; <span class="hljs-keyword">this</span>.includeStructuredData = <span class="hljs-literal">true</span>;
} <span class="hljs-keyword">else</span> { } <span class="hljs-keyword">else</span> {
<span class="hljs-keyword">this</span>.encludeStructuredData = <span class="hljs-literal">false</span>; <span class="hljs-keyword">this</span>.includeStructuredData = <span class="hljs-literal">false</span>;
} }
<span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> options.utf8BOM === <span class="hljs-string">'undefined'</span> || options.utf8BOM) { <span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> options.utf8BOM === <span class="hljs-string">'undefined'</span> || options.utf8BOM) {
<span class="hljs-comment">/** @type {boolean} */</span> <span class="hljs-comment">/** @type {boolean} */</span>
@ -1743,7 +1743,7 @@ uses BSD timeformat</p>
<div class="content"><div class='highlight'><pre> <span class="hljs-keyword">let</span> structuredData = <span class="hljs-string">'-'</span>; <div class="content"><div class='highlight'><pre> <span class="hljs-keyword">let</span> structuredData = <span class="hljs-string">'-'</span>;
<span class="hljs-keyword">const</span> sdElementCount = msgStructuredData.length; <span class="hljs-keyword">const</span> sdElementCount = msgStructuredData.length;
<span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.encludeStructuredData &amp;&amp; sdElementCount &gt; <span class="hljs-number">0</span>) { <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.includeStructuredData &amp;&amp; sdElementCount &gt; <span class="hljs-number">0</span>) {
<span class="hljs-keyword">let</span> sdElementNames = []; <span class="hljs-keyword">let</span> sdElementNames = [];
<span class="hljs-keyword">let</span> sdElements = []; <span class="hljs-keyword">let</span> sdElements = [];
<span class="hljs-keyword">const</span> sdElementNameRegEx = <span class="hljs-regexp">/(\[)(\S*)(\s|\])/</span>;</pre></div></div> <span class="hljs-keyword">const</span> sdElementNameRegEx = <span class="hljs-regexp">/(\[)(\S*)(\s|\])/</span>;</pre></div></div>

View File

@ -96,7 +96,7 @@ create formatted messages or use directly</p>
<pre class="prettyprint source lang-js"><code> let rfc5424 = new SyslogPro.RFC5424({ <pre class="prettyprint source lang-js"><code> let rfc5424 = new SyslogPro.RFC5424({
applicationName: 'MyApp', applicationName: 'MyApp',
timestamp: true, timestamp: true,
encludeStructuredData: true includeStructuredData: true
color: true, color: true,
extendedColor: true, extendedColor: true,
server: { server: {

View File

@ -1091,7 +1091,7 @@ class RFC5424 {
* resolution * resolution
* @param {boolean} [options.timestampTZ=true] - Should the timestamp * @param {boolean} [options.timestampTZ=true] - Should the timestamp
* included time zone * included time zone
* @param {boolean} [options.encludeStructuredData=false] - Included * @param {boolean} [options.includeStructuredData=false] - Included
* any provided structured data * any provided structured data
* @param {boolean} [options.utf8BOM=true] - Included the UTF8 * @param {boolean} [options.utf8BOM=true] - Included the UTF8
* @param {boolean} [options.color=false] - Included the UTF8 * @param {boolean} [options.color=false] - Included the UTF8
@ -1157,11 +1157,11 @@ class RFC5424 {
} else { } else {
this.timestampMS = false; this.timestampMS = false;
} }
if (options.encludeStructuredData) { if (options.includeStructuredData) {
/** @type {boolean} */ /** @type {boolean} */
this.encludeStructuredData = true; this.includeStructuredData = true;
} else { } else {
this.encludeStructuredData = false; this.includeStructuredData = false;
} }
if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) { if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) {
/** @type {boolean} */ /** @type {boolean} */
@ -1494,7 +1494,7 @@ class RFC5424 {
// Build Structured Data string // Build Structured Data string
let structuredData = '-'; let structuredData = '-';
const sdElementCount = msgStructuredData.length; const sdElementCount = msgStructuredData.length;
if (this.encludeStructuredData &amp;&amp; sdElementCount > 0) { if (this.includeStructuredData &amp;&amp; sdElementCount > 0) {
let sdElementNames = []; let sdElementNames = [];
let sdElements = []; let sdElements = [];
const sdElementNameRegEx = /(\[)(\S*)(\s|\])/; const sdElementNameRegEx = /(\[)(\S*)(\s|\])/;

View File

@ -467,7 +467,7 @@ fashion where new messages are written to the class as needed.</div>
<tr> <tr>
<td class="name"><code>encludeStructuredData</code></td> <td class="name"><code>includeStructuredData</code></td>
<td class="type"> <td class="type">
@ -1427,7 +1427,7 @@ fashion where new messages are written to the class as needed.</div>
<h4 class="name" id="encludeStructuredData"><span class="type-signature"></span>encludeStructuredData<span class="type-signature"> :boolean</span></h4> <h4 class="name" id="includeStructuredData"><span class="type-signature"></span>includeStructuredData<span class="type-signature"> :boolean</span></h4>

View File

@ -1052,7 +1052,7 @@ class RFC5424 {
* resolution * resolution
* @param {boolean} [options.timestampTZ=true] - Should the timestamp * @param {boolean} [options.timestampTZ=true] - Should the timestamp
* included time zone * included time zone
* @param {boolean} [options.encludeStructuredData=false] - Included * @param {boolean} [options.includeStructuredData=false] - Included
* any provided structured data * any provided structured data
* @param {boolean} [options.utf8BOM=true] - Included the UTF8 * @param {boolean} [options.utf8BOM=true] - Included the UTF8
* @param {boolean} [options.color=false] - Included the UTF8 * @param {boolean} [options.color=false] - Included the UTF8
@ -1122,11 +1122,11 @@ class RFC5424 {
} else { } else {
this.timestampMS = false; this.timestampMS = false;
} }
if (options.encludeStructuredData) { if (options.includeStructuredData || options.encludeStructuredData) {
/** @type {boolean} */ /** @type {boolean} */
this.encludeStructuredData = true; this.includeStructuredData = true;
} else { } else {
this.encludeStructuredData = false; this.includeStructuredData = false;
} }
if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) { if (typeof options.utf8BOM === 'undefined' || options.utf8BOM) {
/** @type {boolean} */ /** @type {boolean} */
@ -1459,7 +1459,7 @@ class RFC5424 {
// Build Structured Data string // Build Structured Data string
let structuredData = '-'; let structuredData = '-';
const sdElementCount = msgStructuredData.length; const sdElementCount = msgStructuredData.length;
if (this.encludeStructuredData && sdElementCount > 0) { if (this.includeStructuredData && sdElementCount > 0) {
let sdElementNames = []; let sdElementNames = [];
let sdElements = []; let sdElements = [];
const sdElementNameRegEx = /(\[)(\S*)(\s|\])/; const sdElementNameRegEx = /(\[)(\S*)(\s|\])/;

View File

@ -373,7 +373,7 @@ describe('RFC5424 Class Tests', () => {
timestampUTC: true, timestampUTC: true,
timestampTZ: false, timestampTZ: false,
timestampMS: true, timestampMS: true,
encludeStructuredData: true, includeStructuredData: true,
colors: { colors: {
emergencyColor: 30, emergencyColor: 30,
alertColor: 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} /; let resultMsg = /<190>1 \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} /;
expect(result).toMatch(resultMsg); expect(result).toMatch(resultMsg);
let rfc5424 = new SyslogPro.RFC5424({ let rfc5424 = new SyslogPro.RFC5424({
encludeStructuredData: true, includeStructuredData: true,
color: true, color: true,
extendedColor: false, extendedColor: false,
timestamp: true, timestamp: true,