You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My problem was that I added a double-slash at the end of my Loki URL.
e.g. I supplied http://host/ instead of http://host
The patch I'm submitting will help others debug this kind of problem in the future.
I suggest using the almost-standard debug package to supply the user with debugging information.
To enable printing of the debugging information, the user only has to define the following environment variable:
DEBUG=winston-loki
By using this environment variable, the user will get debug information printed to the console like so:
Here is a rough implementation example:
diff --git a/node_modules/winston-loki/src/requests.js b/node_modules/winston-loki/src/requests.js
index 5f57fdc..18a7af3 100644
--- a/node_modules/winston-loki/src/requests.js+++ b/node_modules/winston-loki/src/requests.js@@ -1,5 +1,6 @@
const http = require('http')
const https = require('https')
+const debug = require('debug')('winston-loki')
const post = async (lokiUrl, contentType, headers = {}, data = '', timeout) => {
// Construct a buffer from the data string to have deterministic data size
@@ -25,6 +26,8 @@ const post = async (lokiUrl, contentType, headers = {}, data = '', timeout) => {
timeout: timeout
}
+ debug("sending options: " + JSON.stringify(options, undefined, 2))+
// Construct the request
const req = lib.request(options, res => {
let resData = ''
@@ -34,6 +37,7 @@ const post = async (lokiUrl, contentType, headers = {}, data = '', timeout) => {
// Error listener
req.on('error', error => {
+ debug("loki HTTP error: " + error)
reject(error)
})
I'm interested in creating a PR for this feature.
Thank you for your attention.
The text was updated successfully, but these errors were encountered:
Hi! 👋
Firstly, thanks for creating this life-saving package! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.My problem was that I added a double-slash at the end of my Loki URL.
e.g. I supplied
http://host/
instead ofhttp://host
The patch I'm submitting will help others debug this kind of problem in the future.
I suggest using the almost-standard
debug
package to supply the user with debugging information.To enable printing of the debugging information, the user only has to define the following environment variable:
By using this environment variable, the user will get debug information printed to the console like so:
Here is a rough implementation example:
I'm interested in creating a PR for this feature.
Thank you for your attention.
The text was updated successfully, but these errors were encountered: