fix(readme): update
This commit is contained in:
@ -41,7 +41,7 @@ export class LogAggregator {
|
||||
private async sendAggregatedLogs(logCandidate: ILogCandidate) {
|
||||
this.logObjectMap.remove(logCandidate);
|
||||
// lets post the message to logdna
|
||||
await plugins.smartrequest.postJson(`${this.baseUrl}${logCandidate.urlIdentifier}&now=${Date.now()}` , {
|
||||
const response = await plugins.smartrequest.postJson(`${this.baseUrl}${logCandidate.urlIdentifier}&now=${Date.now()}` , {
|
||||
headers: {
|
||||
Authorization: this.createBasicAuth(),
|
||||
charset: 'UTF-8'
|
||||
@ -50,5 +50,8 @@ export class LogAggregator {
|
||||
lines: logCandidate.logLines
|
||||
}
|
||||
});
|
||||
if(response.statusCode !== 200) {
|
||||
console.log(response.body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,17 +26,20 @@ export class LogdnaAccount {
|
||||
const lm = logdnaMessageArg;
|
||||
const euc = encodeURIComponent;
|
||||
|
||||
// let construct the request uri
|
||||
const requestUrlWithParams = `?hostname=${euc(lm.options.hostname)}&mac=${euc(
|
||||
lm.options.mac
|
||||
)}&ip=1${euc(lm.options.ip)}&tags=${euc(
|
||||
const uriHostname = euc(lm.options.hostname);
|
||||
const uriMac = euc(lm.options.mac);
|
||||
const uriIp = euc(lm.options.ip);
|
||||
const uriTags = euc(
|
||||
(() => {
|
||||
return lm.options.tags.reduce((reduced, newItem) => {
|
||||
return `${reduced},${newItem}`;
|
||||
});
|
||||
})()
|
||||
)}`;
|
||||
|
||||
);
|
||||
|
||||
// let construct the request uri
|
||||
const requestUrlWithParams = `?hostname=${uriHostname}&mac=${uriMac}&ip=1${uriIp}&tags=${uriTags}`;
|
||||
|
||||
const logLine = {
|
||||
timestamp: lm.options.timestamp,
|
||||
line: lm.options.line,
|
||||
@ -47,7 +50,6 @@ export class LogdnaAccount {
|
||||
};
|
||||
|
||||
this.logAggregator.addLog(requestUrlWithParams, logLine);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user