Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
bugfix: json keyval has to be strictly json, and not array
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed Aug 17, 2020
1 parent b0c4129 commit 255993f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Logger {
const auth = username !== '' ? `${username}:${password}@` : ''
const url = `${protocol}://${auth}${host}:${port}/${qs.escape(name)}.${qs.escape(logLevel)}`
const formData = {
json: JSON.stringify(message),
json: JSON.stringify({ message }),
}
if (callback) {
request.post({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hbp-fluentd-logger",
"version": "1.0.1",
"version": "1.0.2",
"description": "Thin wrapper for http(s) fluentd logging.",
"main": "index.js",
"files": [
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const handleRequestCallback = (err, resp, body) => {

if (resp && resp.statusCode >= 400) {
process.stderr.write(`fluentD logging responded error\n`)
console.log(resp)
console.log(JSON.stringify(resp))
process.stderr.write(resp.toString())
process.stderr.write('\n')
}
}

log.emit('info', { hello: 'world', foo: 'bar' }, handleRequestCallback)
log.emit('info', [{ hello: 'world', foo: 'bar' }, 123], handleRequestCallback)

0 comments on commit 255993f

Please sign in to comment.