GELF appender: move facility key into a custom field if present
At the same time, don't assign a default value as the field is optional according to the GELF spec v1.1.
This commit is contained in:
parent
f44af56f9e
commit
5b2d840472
@ -48,7 +48,9 @@ function gelfAppender (layout, host, port, hostname, facility) {
|
||||
host = host || 'localhost';
|
||||
port = port || 12201;
|
||||
hostname = hostname || require('os').hostname();
|
||||
facility = facility || 'nodejs-server';
|
||||
if(facility) {
|
||||
customFields['_facility'] = facility;
|
||||
}
|
||||
layout = layout || layouts.messagePassThroughLayout;
|
||||
|
||||
var defaultCustomFields = customFields || {};
|
||||
@ -103,7 +105,6 @@ function gelfAppender (layout, host, port, hostname, facility) {
|
||||
msg.timestamp = msg.timestamp || new Date().getTime() / 1000; // log should use millisecond
|
||||
msg.host = hostname;
|
||||
msg.level = levelMapping[loggingEvent.level || levels.DEBUG];
|
||||
msg.facility = facility;
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user