Skip to content

Commit

Permalink
Merge pull request #94 from JaniAnttonen/new-release-feb-2022
Browse files Browse the repository at this point in the history
New release, update some test libraries
  • Loading branch information
JaniAnttonen authored Feb 1, 2022
2 parents b825d3b + 8d3a18a commit 0b9c098
Show file tree
Hide file tree
Showing 8 changed files with 5,879 additions and 4,699 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
extends: "standard",
extends: 'standard',
env: {
node: true,
jest: true
},
rules: {
"no-console": "error"
'no-console': 'error'
}
};
}
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ class LokiTransport extends Transport {
if (this.labels) {
lokiLabels = Object.assign(lokiLabels, this.labels)
} else {
lokiLabels['job'] = label
lokiLabels.job = label
}

// follow the format provided
const line = this.useCustomFormat ? info[MESSAGE] : `${message} ${
const line = this.useCustomFormat
? info[MESSAGE]
: `${message} ${
rest && Object.keys(rest).length > 0 ? JSON.stringify(rest) : ''
}`

Expand Down
10,546 changes: 5,862 additions & 4,684 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "winston-loki",
"version": "6.0.3",
"version": "6.0.4",
"description": "A Winston transport for Grafana Loki",
"keywords": [
"winston",
Expand Down Expand Up @@ -59,16 +59,16 @@
},
"devDependencies": {
"coveralls": "^3.0.2",
"eslint": "^5.12.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^3.6.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"jest": "^24.1.0",
"standard": "^12.0.1",
"winston": "^3.1.0"
"jest": "^27.4.7",
"standard": "^16.0.4",
"winston": "^3.5.1"
}
}
2 changes: 1 addition & 1 deletion src/batcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Batcher {
if (options.basicAuth) {
const btoa = require('btoa')
const basicAuth = 'Basic ' + btoa(options.basicAuth)
this.options.headers = Object.assign(this.options.headers, { 'Authorization': basicAuth })
this.options.headers = Object.assign(this.options.headers, { Authorization: basicAuth })
}

// Define the batching intervals
Expand Down
2 changes: 1 addition & 1 deletion src/proto/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
}
let protoLabels = `{level="${logEntry.labels.level}"`
delete logEntry.labels.level
for (let key in logEntry.labels) {
for (const key in logEntry.labels) {
protoLabels += `,${key}="${logEntry.labels[key]}"`
}
protoLabels += '}'
Expand Down
4 changes: 2 additions & 2 deletions test/batcher.protobuf.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Batcher tests with Protobuf + gRPC transport', function () {
const logEntryConverted = createProtoTimestamps(
fixtures.logs[1]
)
const preparedLogEntry = prepareProtoBatch({ streams: [ logEntryConverted ] })
const preparedLogEntry = prepareProtoBatch({ streams: [logEntryConverted] })
const stub = await jest.spyOn(batcher, 'sendBatchToLoki')

batcher.pushLogEntry(fixtures.logs[1])
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('Batcher tests with Protobuf + gRPC transport', function () {
const logEntryConverted = createProtoTimestamps(
fixtures.logs[1]
)
const preparedLogEntry = prepareProtoBatch({ streams: [ logEntryConverted ] })
const preparedLogEntry = prepareProtoBatch({ streams: [logEntryConverted] })
const buffer = logproto.PushRequest.encode(preparedLogEntry).finish()

const snappy = require('snappy')
Expand Down
2 changes: 1 addition & 1 deletion test/transport.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('Integration tests', function () {
line: 'testings ',
ts: 1546977515828
}],
'labels': {
labels: {
job: 'test',
level: 'info'
}
Expand Down

0 comments on commit 0b9c098

Please sign in to comment.