Skip to content

Commit

Permalink
Merge pull request #95 from JaniAnttonen/development
Browse files Browse the repository at this point in the history
Merge new release to master
  • Loading branch information
JaniAnttonen authored Feb 1, 2022
2 parents e36722b + 0b9c098 commit ed2da3d
Show file tree
Hide file tree
Showing 10 changed files with 5,890 additions and 4,713 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'
}
};
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.coveralls.yml
test/coverage

/.idea
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ LokiTransport() takes a Javascript object as an input. These are the options tha
| `format` | winston format (https://github.com/winstonjs/winston#formats) | simple() | null |
| `gracefulShutdown` | Enable/disable graceful shutdown (wait for any unsent batches) | false | true |
| `timeout` | timeout for requests to grafana loki in ms | 30000 | null |
| `basicAuth` | basic authentication credentials to access Loki over HTTP | username:password | null |

### Example
With default formatting:
Expand Down Expand Up @@ -58,7 +59,7 @@ TODO: Add custom formatting example
### Requirements
Running a local Loki for testing is probably required, and the easiest way to do that is to follow this guide: https://github.com/grafana/loki/tree/master/production#run-locally-using-docker. After that, Grafana Loki instance is available at `http://localhost:3100`, with a Grafana instance running at `http://localhost:3000`. Username `admin`, password `admin`. Add the Loki source with the URL `http://loki:3100`, and the explorer should work.

Refer to https://github.com/grafana/loki/blob/master/docs/api.md for documentation about the available endpoints, data formats etc.
Refer to https://grafana.com/docs/loki/latest/api/ for documentation about the available endpoints, data formats etc.

### Example
```sh
Expand Down
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
Loading

0 comments on commit ed2da3d

Please sign in to comment.