RFC3164

SyslogPro~ RFC3164

A class to work with RFC3164 formated syslog messages.

Constructor

new RFC3164(optionsopt)

Source:
Version:
  • 0.0.0
Since:
  • 0.0.0
Construct a new RFC3164 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
facility number <optional>
23 Facility code to use sending this message
color boolean <optional>
false Apply color coding encoding tag with syslog message text
extendedColor boolean <optional>
false Use the extedned ANSI color set 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:

(private) errorColor

Source:

extendedColor :boolean

Source:
Type:
  • boolean

(private) informationalColor

Source:

(private) noticeColor

Source:

(private) server

Source:

(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
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, optionsopt) → {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 Attributes Description
msg string The unformated Syslog message to send
options object <optional>
Options object
Properties
Name Type Attributes Default Description
severity number <optional>
7 An array of structure
colorCode number <optional>
36 The ANSI color code to use if
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