RFC5424

SyslogPro~ RFC5424

A class to work with RFC5424 formated syslog messages.

Constructor

new RFC5424(optionsopt)

Source:
Version:
  • 0.0.0
Since:
  • 0.0.0
Construct a new RFC5424 formated Syslog object with user options
Parameters:
Name Type Attributes Description
options object <optional>
Options object
Properties
Name Type Attributes Default Description
applacationName string <optional>
'NodeJSLogger' Applacation
hostname string <optional>
os.hostname The name of this server
timestamp boolean <optional>
false Included a Timestamp
timestampUTC boolean <optional>
false RFC tandard is for local time
timestampMS boolean <optional>
false Timestamp with ms resoltuion
timestampTZ boolean <optional>
true Should the timestamp included timezone
encludeStructuredData boolean <optional>
false Included any provided structured data
utf8BOM boolean <optional>
true Included the UTF8
color boolean <optional>
false Included the UTF8
extendedColor boolean <optional>
false Included the UTF8 encoding tag with syslog message text
colors object <optional>
User defended colors for severites
Properties
Name Type Attributes Description
emergencyColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
alertColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
criticalColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
errorColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
warningColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
noticeColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
informationalColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
debugColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
server Syslog <optional>
false A Syslog server connection that should be used to send messages directly from this class. @see SyslogPro~Syslog
Requires:
  • module:moment

Requires

  • module:moment

Members

(private) alertColor

Source:

color :boolean

Source:
Type:
  • boolean

(private) constructor__

Source:

(private) criticalColor

Source:

(private) debugColor

Source:

(private) emergencyColor

Source:

encludeStructuredData :boolean

Source:
Type:
  • boolean

(private) errorColor

Source:

extendedColor :boolean

Source:
Type:
  • boolean

(private) informationalColor

Source:

(private) noticeColor

Source:

(private) server

Source:

timestamp :boolean

Source:
Type:
  • boolean

timestampMS :boolean

Source:
Type:
  • boolean

timestampTZ :boolean

Source:
Type:
  • boolean

timestampUTC :boolean

Source:
Type:
  • boolean

utf8BOM :boolean

Source:
Type:
  • boolean

(private) warningColor

Source:

Methods

alert(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 1 (Alert)
Parameters:
Name Type Description
msg string The alert message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

buildMessage(msg, optionsopt) → {Promise}

Source:
Building a formated message. Returns a promise with a formated message
Parameters:
Name Type Attributes Description
msg string The Syslog Message
options object <optional>
Options object
Properties
Name Type Attributes Default Description
severity number <optional>
7 An array of structure
facility number <optional>
23 Facility code to use sending this message
pid string <optional>
'-' The process id of the service sending this message
structuredData Array.<string> <optional>
An array of structure data strings conforming to the IETF/IANA defined SD-IDs or IANA registred SMI Network Management Private Enterprise Code SD-ID conforming to the format [name@ parameter=value]
colorCode number <optional>
36 The ANSI color code to use if message coloration is selected
Throws:
A standard error object
Type
Error
Returns:
A Syslog formated string acording to the selected RFC
Type
Promise

crit(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 2 (Critical)
Parameters:
Name Type Description
msg string The critical message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

critical(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 2 (Critical)
Parameters:
Name Type Description
msg string The critical message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

debug(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 7 (Debug)
Parameters:
Name Type Description
msg string The debug message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

emer(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 0 (Emergency)
Parameters:
Name Type Description
msg string The emergancy message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

emergency(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 0 (Emergency)
Parameters:
Name Type Description
msg string The emergancy message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

err(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 3 (Error)
Parameters:
Name Type Description
msg string The error message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

error(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 3 (Error)
Parameters:
Name Type Description
msg string The error message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

info(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 6 (Informational)
Parameters:
Name Type Description
msg string The informational message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

informational(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 6 (Informational)
Parameters:
Name Type Description
msg string The informational message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

log(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 6 (Informational)
Parameters:
Name Type Description
msg string The informational message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

note(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 5 (Notice)
Parameters:
Name Type Description
msg string The notice message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

notice(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 5 (Notice)
Parameters:
Name Type Description
msg string The notice message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

send(msg) → {Promise}

Source:
See:
  • SyslogPro~Syslog
send a RFC5424 formated message. Returns a promise with the formated message that was sent. If no server connection was defined when the class was created a defualt Syslog connector will be used.
Parameters:
Name Type Description
msg string The unformated Syslog message to send
Throws:
A standard error object
Type
Error
Returns:
A Syslog formated string acording to the selected RFC
Type
Promise

setColor()

Source:
Sets the color to be used for messages at a set priority
Parameters:
Name Type Attributes Description
colors.emergencyColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
colors.alertColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
colors.criticalColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
colors.errorColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
colors.warningColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
colors.noticeColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
colors.informationalColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
colors.debugColor string <optional>
A RGB Hex coded color in the form of #FFFFFF or as or the ANSI color code number (30-37 Standard & 0-255 Extended)
Throws:
A standard error object
Type
Error

warn(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 4 (Warning)
Parameters:
Name Type Description
msg string The warning message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise

warning(msg) → {Promise}

Source:
Send a syslog message with a secerity level of 4 (Warning)
Parameters:
Name Type Description
msg string The warning message to send to the Syslog server
Throws:
- Any bubbled up error
Type
Error
Returns:
- The formated syslog message sent to the Syslog server
Type
Promise