Skip to content

Commit

Permalink
Merge pull request #50 from JaniAnttonen/fix/remove-debug-logs
Browse files Browse the repository at this point in the history
Remove debug logs
  • Loading branch information
JaniAnttonen authored Oct 27, 2020
2 parents 8a39e49 + a06c21c commit 8c97a5e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
module.exports = {
extends: ["standard"],
extends: "standard",
env: {
node: true,
jest: true
},
rules: {
"no-console": "error"
}
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"build:proto": "./node_modules/.bin/pbjs -t static-module -w commonjs -o ./src/proto/index.js ./src/proto/logproto.proto && npm run lint:fix",
"test": "./node_modules/.bin/standard && ./node_modules/.bin/jest",
"lint": "./node_modules/.bin/standard",
"lint": "./node_modules/.bin/eslint *",
"lint:fix": "./node_modules/.bin/standard --fix",
"coverage": "jest --coverage",
"coveralls": "jest --coverage && cat ./test/coverage/lcov.info | coveralls"
Expand Down
7 changes: 2 additions & 5 deletions src/batcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Batcher {
}

// Define the batching intervals
this.interval = this.options.interval
this.interval = this.options.interval && this.options.interval !== undefined
? Number(this.options.interval) * 1000
: 5000
this.circuitBreakerInterval = 60000
Expand Down Expand Up @@ -184,21 +184,18 @@ class Batcher {

// Create the PushRequest object
const message = logproto.PushRequest.create(preparedBatch)
console.log(message)
// Encode the PushRequest object and create the binary buffer
const buffer = logproto.PushRequest.encode(message).finish()
console.log(buffer)
// Compress the buffer with snappy
reqBody = snappy.compressSync(buffer)
} catch (err) {
console.log(err)
reject(err)
}
}

// Send the data to Grafana Loki
req.post(this.url, this.contentType, this.options.headers, reqBody)
.then(res => {
.then(() => {
// No need to clear the batch if batching is disabled
logEntry === undefined && this.clearBatch()
resolve()
Expand Down

0 comments on commit 8c97a5e

Please sign in to comment.