fix(core): update
This commit is contained in:
parent
99bfc485cf
commit
6c471f3722
15
package-lock.json
generated
15
package-lock.json
generated
@ -127,12 +127,19 @@
|
|||||||
"integrity": "sha512-HbH2b6ybd1cD8VTlx5kEt4N/Vgh9TQTHKlUV4kAORFIOTJOQD5WbCMIVWo+VqYHvYQtokoYFCjM1gctp4M1aWw==",
|
"integrity": "sha512-HbH2b6ybd1cD8VTlx5kEt4N/Vgh9TQTHKlUV4kAORFIOTJOQD5WbCMIVWo+VqYHvYQtokoYFCjM1gctp4M1aWw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartlog-interfaces": "^1.0.9"
|
"@pushrocks/smartlog-interfaces": "^1.0.9"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
"@pushrocks/smartlog-interfaces": {
|
"@pushrocks/smartlog-interfaces": {
|
||||||
"version": "1.0.15",
|
"version": "1.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-1.0.15.tgz",
|
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-1.0.15.tgz",
|
||||||
"integrity": "sha512-dn9a+IhneukhtVGQG031oodOITmmQ5s5hcMThd+cMUQL3XYTbLPnZVuJfTDeWCT0iqLqrBD/qp2d1RRc3W/qIQ=="
|
"integrity": "sha512-dn9a+IhneukhtVGQG031oodOITmmQ5s5hcMThd+cMUQL3XYTbLPnZVuJfTDeWCT0iqLqrBD/qp2d1RRc3W/qIQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@pushrocks/smartlog-interfaces": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-rk3uEp78AXLULS81SUe6YtZvyQiDImuJu/zxnIzzUFDB6ciisqtJ1qVcHYbVsW/kImeo8vBFlQyKY9/YaNgkDw=="
|
||||||
},
|
},
|
||||||
"@pushrocks/smartpath": {
|
"@pushrocks/smartpath": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
@ -268,9 +275,9 @@
|
|||||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "10.12.1",
|
"version": "10.12.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.2.tgz",
|
||||||
"integrity": "sha512-i1sl+WCX2OCHeUi9oi7PiCNUtYFrpWhpcx878vpeq/tlZTKzcFdHePlyFHVbWqeuKN0SRPl/9ZFDSTsfv9h7VQ=="
|
"integrity": "sha512-53ElVDSnZeFUUFIYzI8WLQ25IhWzb6vbddNp8UHlXQyU0ET2RhV5zg0NfubzU7iNMh5bBXb0htCzfvrSVNgzaQ=="
|
||||||
},
|
},
|
||||||
"@types/vinyl": {
|
"@types/vinyl": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tstest": "^1.0.15",
|
||||||
"@pushrocks/qenv": "^2.0.2",
|
"@pushrocks/qenv": "^2.0.2",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"@types/node": "^10.11.7",
|
"@types/node": "^10.12.2",
|
||||||
"tslint": "^5.11.0",
|
"tslint": "^5.11.0",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartlog-interfaces": "^1.0.15",
|
"@pushrocks/smartlog-interfaces": "^2.0.0",
|
||||||
"@pushrocks/smartrequest": "^1.1.14",
|
"@pushrocks/smartrequest": "^1.1.14",
|
||||||
"@pushrocks/smartstring": "^3.0.4",
|
"@pushrocks/smartstring": "^3.0.4",
|
||||||
"@pushrocks/taskbuffer": "^2.0.5"
|
"@pushrocks/taskbuffer": "^2.0.5"
|
||||||
|
@ -14,7 +14,9 @@ tap.test('should create a valid logDna account', async () => {
|
|||||||
|
|
||||||
tap.test('should create a standard log message', async () => {
|
tap.test('should create a standard log message', async () => {
|
||||||
testLogMessage = logdna.LogdnaMessage.fromSmartLogPackage({
|
testLogMessage = logdna.LogdnaMessage.fromSmartLogPackage({
|
||||||
logContext: {
|
type: 'log',
|
||||||
|
level: 'info',
|
||||||
|
context: {
|
||||||
company: 'Lossless GmbH',
|
company: 'Lossless GmbH',
|
||||||
companyunit: 'lossless.cloud',
|
companyunit: 'lossless.cloud',
|
||||||
containerName: 'ci-mojoio-logdna',
|
containerName: 'ci-mojoio-logdna',
|
||||||
@ -22,7 +24,6 @@ tap.test('should create a standard log message', async () => {
|
|||||||
runtime: 'node',
|
runtime: 'node',
|
||||||
zone: 'ship.zone'
|
zone: 'ship.zone'
|
||||||
},
|
},
|
||||||
logLevel: 'info',
|
|
||||||
message: 'this is a awesome log message :)'
|
message: 'this is a awesome log message :)'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -63,15 +63,15 @@ export class LogdnaMessage {
|
|||||||
static fromSmartLogPackage(smartlogPackageArg: ILogPackage): LogdnaMessage {
|
static fromSmartLogPackage(smartlogPackageArg: ILogPackage): LogdnaMessage {
|
||||||
return new LogdnaMessage({
|
return new LogdnaMessage({
|
||||||
line: smartlogPackageArg.message,
|
line: smartlogPackageArg.message,
|
||||||
meta: smartlogPackageArg.logContext,
|
meta: smartlogPackageArg.context,
|
||||||
env: smartlogPackageArg.logContext.environment,
|
env: smartlogPackageArg.context.environment,
|
||||||
hostname: smartlogPackageArg.logContext.zone,
|
hostname: smartlogPackageArg.context.zone,
|
||||||
level: smartlogPackageArg.logLevel,
|
level: smartlogPackageArg.level,
|
||||||
app: smartlogPackageArg.logContext.zone,
|
app: smartlogPackageArg.context.zone,
|
||||||
tags: (() => {
|
tags: (() => {
|
||||||
const tagArray: string[] = [];
|
const tagArray: string[] = [];
|
||||||
tagArray.push(smartlogPackageArg.logContext.company);
|
tagArray.push(smartlogPackageArg.context.company);
|
||||||
tagArray.push(smartlogPackageArg.logContext.companyunit);
|
tagArray.push(smartlogPackageArg.context.companyunit);
|
||||||
return tagArray;
|
return tagArray;
|
||||||
})(),
|
})(),
|
||||||
ip: '0.0.0.0',
|
ip: '0.0.0.0',
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
import * as plugins from './logdna.plugins';
|
import * as plugins from './logdna.plugins';
|
||||||
|
|
||||||
import { LogdnaMessage } from './logdna.classes.logmessage';
|
import { LogdnaMessage } from './logdna.classes.logmessage';
|
||||||
|
import { ILogPackage } from '@pushrocks/smartlog-interfaces';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the main logdna account
|
* the main logdna account
|
||||||
*/
|
*/
|
||||||
export class LogdnaAccount {
|
export class LogdnaAccount {
|
||||||
apiKey: string;
|
private apiKey: string;
|
||||||
baseUrl = 'https://logs.logdna.com/logs/ingest';
|
private baseUrl = 'https://logs.logdna.com/logs/ingest';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create basic authentication
|
* Create basic authentication
|
||||||
*/
|
*/
|
||||||
createBasicAuth() {
|
private createBasicAuth() {
|
||||||
const userNamePasswordString = `${this.apiKey}:`;
|
const userNamePasswordString = `${this.apiKey}:`;
|
||||||
return `Basic ${plugins.smartstring.base64.encode(userNamePasswordString)}`;
|
return `Basic ${plugins.smartstring.base64.encode(userNamePasswordString)}`;
|
||||||
}
|
}
|
||||||
@ -66,4 +67,11 @@ export class LogdnaAccount {
|
|||||||
requestBody: requestBodyObject
|
requestBody: requestBodyObject
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* convenience function for smartlog
|
||||||
|
*/
|
||||||
|
async sendSmartlogPackage (smartlogPackageArg: ILogPackage) {
|
||||||
|
this.sendLogDnaMessage(LogdnaMessage.fromSmartLogPackage(smartlogPackageArg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user