Skip to content

Commit

Permalink
Merge pull request #110 from m4x1m1l14n/development
Browse files Browse the repository at this point in the history
Override loki transport label with log label when label with same name is provided
  • Loading branch information
JaniAnttonen authored Jun 8, 2022
2 parents f720011 + 8e07109 commit 7e64531
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ class LokiTransport extends Transport {

// build custom labels if provided
let lokiLabels = { level: level }
lokiLabels = Object.assign(lokiLabels, labels)

if (this.labels) {
lokiLabels = Object.assign(lokiLabels, this.labels)
} else {
lokiLabels.job = label
}

lokiLabels = Object.assign(lokiLabels, labels)

// follow the format provided
const line = this.useCustomFormat
? info[MESSAGE]
Expand Down

0 comments on commit 7e64531

Please sign in to comment.