Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Compose additional fields from meta, each additional key starting wit…

…h underscore.
  • Loading branch information...
commit e4e785696a08ed70e7787a37cbc5f8a7555643c6 1 parent 096ed29
@arttu arttu authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/winston-graylog2.js
View
8 lib/winston-graylog2.js
@@ -49,6 +49,14 @@ Graylog2.prototype.log = function (level, msg, meta, callback) {
message.full_message = meta || {};
message.level = getMessageLevel(level);
+ if (!!meta) {
+ Object.keys(meta).forEach(function(key) {
+ if (key != 'id') {
+ message['_'+key] = meta[key];
+ }
+ });
+ }
+
var compressedMessage = compress(new Buffer(JSON.stringify(message)));
if (compressedMessage.length > 8192) {
Please sign in to comment.
Something went wrong with that request. Please try again.