Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
faf736f353 | |||
dca54899bf | |||
7dac427f00 | |||
e451c38f32 | |||
540e5be2fa | |||
7d29f88356 | |||
9d81f059fe | |||
52cdf6f9fe | |||
1339db1adf | |||
2b42bd59c5 | |||
4cd9ce8510 | |||
cf2620bd41 |
@ -54,17 +54,6 @@ testStable:
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- windows
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
|
23382
package-lock.json
generated
23382
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mojoio/logdna",
|
||||
"version": "1.0.30",
|
||||
"version": "1.0.36",
|
||||
"private": false,
|
||||
"description": "an unoffical package for the logdna api",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -13,20 +13,20 @@
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.24",
|
||||
"@gitzone/tstest": "^1.0.33",
|
||||
"@pushrocks/qenv": "^4.0.6",
|
||||
"@pushrocks/tapbundle": "^3.2.1",
|
||||
"@types/node": "^14.0.9",
|
||||
"tslint": "^6.1.2",
|
||||
"@gitzone/tsbuild": "^2.1.25",
|
||||
"@gitzone/tstest": "^1.0.54",
|
||||
"@pushrocks/qenv": "^4.0.10",
|
||||
"@pushrocks/tapbundle": "^3.2.14",
|
||||
"@types/node": "^14.0.11",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^4.0.13",
|
||||
"@pushrocks/smartlog-interfaces": "^2.0.9",
|
||||
"@pushrocks/smartrequest": "^1.1.47",
|
||||
"@pushrocks/smartstring": "^3.0.18",
|
||||
"@pushrocks/taskbuffer": "^2.1.1"
|
||||
"@pushrocks/lik": "^4.0.20",
|
||||
"@pushrocks/smartlog-interfaces": "^2.0.22",
|
||||
"@pushrocks/smartrequest": "^1.1.52",
|
||||
"@pushrocks/smartstring": "^3.0.24",
|
||||
"@pushrocks/taskbuffer": "^2.1.13"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
18
test/test.ts
18
test/test.ts
@ -26,6 +26,10 @@ tap.test('should create a standard log message', async () => {
|
||||
runtime: 'node',
|
||||
zone: 'shipzone'
|
||||
},
|
||||
correlation: {
|
||||
id: '123',
|
||||
type: 'none'
|
||||
},
|
||||
message: 'this is an awesome log message sent by the tapbundle test'
|
||||
});
|
||||
});
|
||||
@ -49,7 +53,11 @@ tap.test('should send in order', async () => {
|
||||
runtime: 'node',
|
||||
zone: 'shipzone'
|
||||
},
|
||||
message: `this is an awesome log message sent by the tapbundle test #${i}`
|
||||
message: `this is an awesome log message sent by the tapbundle test #${i}`,
|
||||
correlation: {
|
||||
id: '123',
|
||||
type: 'none'
|
||||
}
|
||||
};
|
||||
testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage);
|
||||
i++;
|
||||
@ -67,6 +75,10 @@ tap.test('should send in order', async () => {
|
||||
runtime: 'node',
|
||||
zone: 'shipzone'
|
||||
},
|
||||
correlation: {
|
||||
id: '123',
|
||||
type: 'none'
|
||||
},
|
||||
message: `this is an awesome log message sent by the tapbundle test #${i}`
|
||||
};
|
||||
testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage2);
|
||||
@ -83,6 +95,10 @@ tap.test('should send in order', async () => {
|
||||
runtime: 'node',
|
||||
zone: 'shipzone'
|
||||
},
|
||||
correlation: {
|
||||
id: '123',
|
||||
type: 'none'
|
||||
},
|
||||
message: `this is an awesome log message sent by the tapbundle test #${i}`
|
||||
};
|
||||
testLogDnaAccount.sendSmartlogPackage(testSmartlogMessage3);
|
||||
|
@ -41,8 +41,9 @@ export class LogAggregator {
|
||||
private async sendAggregatedLogs(logCandidate: ILogCandidate) {
|
||||
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(
|
||||
`${this.baseUrl}${logCandidate.urlIdentifier}&now=${Date.now()}`,
|
||||
url,
|
||||
{
|
||||
headers: {
|
||||
Authorization: this.createBasicAuth(),
|
||||
|
@ -71,7 +71,9 @@ export class LogdnaMessage {
|
||||
line: smartlogPackageArg.message,
|
||||
meta: {
|
||||
...smartlogPackageArg.context,
|
||||
logType: smartlogPackageArg.type
|
||||
logType: smartlogPackageArg.type,
|
||||
correlation: smartlogPackageArg.correlation,
|
||||
data: smartlogPackageArg.data || {}
|
||||
},
|
||||
env: smartlogPackageArg.context.environment,
|
||||
hostname: smartlogPackageArg.context.zone,
|
||||
|
@ -31,11 +31,16 @@ export class LogdnaAccount {
|
||||
const uriIp = euc(lm.options.ip);
|
||||
const uriTags = euc(
|
||||
(() => {
|
||||
let first = true;
|
||||
return lm.options.tags.reduce((reduced, newItem) => {
|
||||
return `${reduced},${newItem}`;
|
||||
if (first) {
|
||||
first = false;
|
||||
reduced = euc(reduced);
|
||||
}
|
||||
return `${reduced},${euc(newItem)})`;
|
||||
});
|
||||
})()
|
||||
);
|
||||
)
|
||||
|
||||
// let construct the request uri
|
||||
const requestUrlWithParams = `?hostname=${uriHostname}&mac=${uriMac}&ip=1${uriIp}&tags=${uriTags}`;
|
||||
@ -64,7 +69,7 @@ export class LogdnaAccount {
|
||||
*/
|
||||
public get smartlogDestination(): ILogDestination {
|
||||
return {
|
||||
handleLog: logPackageArg => {
|
||||
handleLog: async logPackageArg => {
|
||||
this.sendSmartlogPackage(logPackageArg);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user