Skip to content
Snippets Groups Projects
Unverified Commit 658955ae authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Added loglevel

parent 6a15cd3a
Branches
Tags
1 merge request!1Update index.test.js, examples/all-options.js, examples/log-to-file.js,...
...@@ -176,19 +176,20 @@ function Log (options) { ...@@ -176,19 +176,20 @@ function Log (options) {
} }
} }
if (this.options.loki && this.options.loki.active) { if (this.options.loki && this.options.loki.active) {
let data = JSON.stringify({ let data = {
streams: [ streams: [
{ {
stream: { stream: {
hostname: this.hostname, hostname: this.hostname,
app: this.name app: this.name,
level: this.levels[tag]
}, },
values: [ values: [
[Date.now().toString(), message] [Date.now().toString(), message]
] ]
} }
] ]
}) }
this.request.post(this.options.loki.server + '/loki/api/v1/push', {body: data, json: true, strictSSL: false}, (error, res, body) => { this.request.post(this.options.loki.server + '/loki/api/v1/push', {body: data, json: true, strictSSL: false}, (error, res, body) => {
if (error) { if (error) {
console.error(error) console.error(error)
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment