Skip to content

Commit

Permalink
accept-encoding: the key format is not valid, closes #11; closes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
kkamkou committed Apr 4, 2016
1 parent b6e871e commit fee0cdb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ log.info(new Error('An error message'));
##### Extra
In case `extra` [is a plain object](https://lodash.com/docs#isPlainObject),
the library converts it to a readable format. Other values [are converted to string](https://lodash.com/docs#toString).
Acceptable format is: `^[\w.-]$`
```javascript
log.info(
'a new msg goes here',
Expand Down
2 changes: 1 addition & 1 deletion lib/gelf-pro.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ gelf.getStringFromObject = function (obj) {
// recursion function for key-value aggregation
var recursion = function (input, prefix) {
_.forOwn(input, function (value, key) {
if ((/[^\w]/).test(key)) {
if ((/[^\w.-]/).test(key)) {
console.warn(key + ': the key format is not valid');
}
if (_.isPlainObject(value)) {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gelf-pro",
"version": "0.6.2",
"version": "0.6.3",
"main": "./lib/gelf-pro.js",
"author": "Kanstantsin Kamkou <[email protected]>",
"description": "The Graylog Extended Log Format for the Node.js",
Expand All @@ -22,15 +22,15 @@
"test": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"dependencies": {
"lodash": "~4.5",
"lodash": "~4.7",
"async": "~1.5"
},
"devDependencies": {
"istanbul": "~0.4.2",
"should": "~8.2",
"should": "~8.3",
"mocha": "~2.4",
"mocha-lcov-reporter": "~1.2.0",
"coveralls": "~2.11.8",
"coveralls": "~2.11",
"sinon": "~1.17"
}
}
7 changes: 6 additions & 1 deletion test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ module.exports = {
level2: {
level3: {value3: 'value3'},
value2: 'value2'
}
},
'key.with.dot': 1,
'key-with-dash': 1
}
});

Expand All @@ -103,8 +105,11 @@ module.exports = {
result = JSON.parse(result);
result.should.have.property('_value0').equal('value0');
result.should.have.property('_level1_value1').equal('value1');
result.should.have.property('_level1_key.with.dot').equal(1);
result.should.have.property('_level1_key-with-dash').equal(1);
result.should.have.property('_level1_level2_value2').equal('value2');
result.should.have.property('_level1_level2_level3_value3').equal('value3');

},

'Work with dates': function () {
Expand Down

0 comments on commit fee0cdb

Please sign in to comment.