fix(core): update
This commit is contained in:
@ -25,7 +25,7 @@ export class LogAggregator {
|
||||
}
|
||||
|
||||
public addLog(urlIdentifierArg: string, logLineArg: any) {
|
||||
let existinglogCandidate = this.logObjectMap.find(logCandidate => {
|
||||
let existinglogCandidate = this.logObjectMap.find((logCandidate) => {
|
||||
return logCandidate.urlIdentifier === urlIdentifierArg;
|
||||
});
|
||||
if (!existinglogCandidate) {
|
||||
@ -42,18 +42,15 @@ export class LogAggregator {
|
||||
this.logObjectMap.remove(logCandidate);
|
||||
// lets post the message to logdna
|
||||
const url = `${this.baseUrl}${logCandidate.urlIdentifier}&now=${Date.now()}`;
|
||||
const response = await plugins.smartrequest.postJson(
|
||||
url,
|
||||
{
|
||||
headers: {
|
||||
Authorization: this.createBasicAuth(),
|
||||
charset: 'UTF-8'
|
||||
},
|
||||
requestBody: {
|
||||
lines: logCandidate.logLines
|
||||
}
|
||||
}
|
||||
);
|
||||
const response = await plugins.smartrequest.postJson(url, {
|
||||
headers: {
|
||||
Authorization: this.createBasicAuth(),
|
||||
charset: 'UTF-8',
|
||||
},
|
||||
requestBody: {
|
||||
lines: logCandidate.logLines,
|
||||
},
|
||||
});
|
||||
if (response.statusCode !== 200) {
|
||||
console.log(response.body);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export class LogdnaMessage {
|
||||
...smartlogPackageArg.context,
|
||||
logType: smartlogPackageArg.type,
|
||||
correlation: smartlogPackageArg.correlation,
|
||||
data: smartlogPackageArg.data || {}
|
||||
data: smartlogPackageArg.data || {},
|
||||
},
|
||||
env: smartlogPackageArg.context.environment,
|
||||
hostname: smartlogPackageArg.context.zone,
|
||||
@ -86,7 +86,7 @@ export class LogdnaMessage {
|
||||
return tagArray;
|
||||
})(),
|
||||
ip: '0.0.0.0',
|
||||
mac: 'aa:aa:aa:aa:aa:aa'
|
||||
mac: 'aa:aa:aa:aa:aa:aa',
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ export class LogdnaAccount {
|
||||
return `${reduced},${euc(newItem)}`;
|
||||
});
|
||||
})()
|
||||
)
|
||||
);
|
||||
|
||||
// let construct the request uri
|
||||
const requestUrlWithParams = `?hostname=${uriHostname}&mac=${uriMac}&ip=1${uriIp}&tags=${uriTags}`;
|
||||
@ -51,7 +51,7 @@ export class LogdnaAccount {
|
||||
app: lm.options.app,
|
||||
level: lm.options.level,
|
||||
env: lm.options.env,
|
||||
meta: lm.options.meta
|
||||
meta: lm.options.meta,
|
||||
};
|
||||
|
||||
this.logAggregator.addLog(requestUrlWithParams, logLine);
|
||||
@ -69,9 +69,9 @@ export class LogdnaAccount {
|
||||
*/
|
||||
public get smartlogDestination(): ILogDestination {
|
||||
return {
|
||||
handleLog: async logPackageArg => {
|
||||
handleLog: async (logPackageArg) => {
|
||||
this.sendSmartlogPackage(logPackageArg);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user