fix(core): update
This commit is contained in:
parent
76d3926ba4
commit
a8bac181a4
6
package-lock.json
generated
6
package-lock.json
generated
@ -137,9 +137,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartlog-interfaces": {
|
"@pushrocks/smartlog-interfaces": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.2.tgz",
|
||||||
"integrity": "sha512-c9onE52z/5fGX5uEvaI/rXbcC6n7PkLrNjehRM+6JsK7HIbdAzrgY1PGrqUfW0a03hSe03mFcggORID+fQI4tA=="
|
"integrity": "sha512-kJNQ/6kfljgtwebhoiD8WtRWfdVhOoE1nr8FoUJLlOjLphU8SPa42Hg6/yPkSTaGxWwDhk6PkMJl64O7HNjRUQ=="
|
||||||
},
|
},
|
||||||
"@pushrocks/smartpath": {
|
"@pushrocks/smartpath": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartlog-interfaces": "^2.0.1",
|
"@pushrocks/smartlog-interfaces": "^2.0.2",
|
||||||
"@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,8 @@ 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({
|
||||||
type: 'log',
|
timestamp: Date.now(),
|
||||||
|
type: 'log',
|
||||||
level: 'info',
|
level: 'info',
|
||||||
context: {
|
context: {
|
||||||
company: 'Lossless GmbH',
|
company: 'Lossless GmbH',
|
||||||
@ -24,7 +25,7 @@ tap.test('should create a standard log message', async () => {
|
|||||||
runtime: 'node',
|
runtime: 'node',
|
||||||
zone: 'shipzone'
|
zone: 'shipzone'
|
||||||
},
|
},
|
||||||
message: 'this is an awesome log message :)'
|
message: 'this is an awesome log message sent by the tapbundle test'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,6 +6,11 @@ import { TLogLevel, TEnvironment, ILogPackage } from '@pushrocks/smartlog-interf
|
|||||||
* the constructor options for LogdnaMessage
|
* the constructor options for LogdnaMessage
|
||||||
*/
|
*/
|
||||||
export interface ILogdnaMessageContructorOptions {
|
export interface ILogdnaMessageContructorOptions {
|
||||||
|
/**
|
||||||
|
* a timestamp for then the log message was created
|
||||||
|
*/
|
||||||
|
timestamp: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the hostname where the log message was created
|
* the hostname where the log message was created
|
||||||
*/
|
*/
|
||||||
@ -62,6 +67,7 @@ export class LogdnaMessage {
|
|||||||
*/
|
*/
|
||||||
static fromSmartLogPackage(smartlogPackageArg: ILogPackage): LogdnaMessage {
|
static fromSmartLogPackage(smartlogPackageArg: ILogPackage): LogdnaMessage {
|
||||||
return new LogdnaMessage({
|
return new LogdnaMessage({
|
||||||
|
timestamp: smartlogPackageArg.timestamp,
|
||||||
line: smartlogPackageArg.message,
|
line: smartlogPackageArg.message,
|
||||||
meta: {
|
meta: {
|
||||||
...smartlogPackageArg.context,
|
...smartlogPackageArg.context,
|
||||||
|
@ -37,21 +37,23 @@ export class LogdnaAccount {
|
|||||||
// let construct the request uri
|
// let construct the request uri
|
||||||
const requestUrlWithParams = `${this.baseUrl}?hostname=${euc(lm.options.hostname)}&mac=${euc(
|
const requestUrlWithParams = `${this.baseUrl}?hostname=${euc(lm.options.hostname)}&mac=${euc(
|
||||||
lm.options.mac
|
lm.options.mac
|
||||||
)}&ip=1${euc(lm.options.ip)}&now=${Date.now()}`;
|
)}&ip=1${euc(lm.options.ip)}&now=${Date.now()}&tags=${euc(
|
||||||
|
(() => {
|
||||||
|
return lm.options.tags.reduce((reduced, newItem) => {
|
||||||
|
return `${reduced},${newItem}`;
|
||||||
|
});
|
||||||
|
})()
|
||||||
|
)}`;
|
||||||
|
|
||||||
const requestBodyObject = {
|
const requestBodyObject = {
|
||||||
lines: [
|
lines: [
|
||||||
{
|
{
|
||||||
|
timestamp: lm.options.timestamp,
|
||||||
line: lm.options.line,
|
line: lm.options.line,
|
||||||
app: lm.options.app,
|
app: lm.options.app,
|
||||||
level: lm.options.level,
|
level: lm.options.level,
|
||||||
env: lm.options.env,
|
env: lm.options.env,
|
||||||
meta: lm.options.meta,
|
meta: lm.options.meta
|
||||||
tags: (() => {
|
|
||||||
return lm.options.tags.reduce((reduced, newItem) => {
|
|
||||||
return `${reduced},${newItem}`;
|
|
||||||
});
|
|
||||||
})()
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -71,16 +73,16 @@ export class LogdnaAccount {
|
|||||||
/**
|
/**
|
||||||
* convenience function for smartlog
|
* convenience function for smartlog
|
||||||
*/
|
*/
|
||||||
public async sendSmartlogPackage (smartlogPackageArg: ILogPackage) {
|
public async sendSmartlogPackage(smartlogPackageArg: ILogPackage) {
|
||||||
this.sendLogDnaMessage(LogdnaMessage.fromSmartLogPackage(smartlogPackageArg));
|
this.sendLogDnaMessage(LogdnaMessage.fromSmartLogPackage(smartlogPackageArg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns a smartlog compatible log destination
|
* returns a smartlog compatible log destination
|
||||||
*/
|
*/
|
||||||
public get smartlogDestination (): ILogDestination {
|
public get smartlogDestination(): ILogDestination {
|
||||||
return {
|
return {
|
||||||
handleLog: (logPackageArg) => {
|
handleLog: logPackageArg => {
|
||||||
this.sendSmartlogPackage(logPackageArg);
|
this.sendSmartlogPackage(logPackageArg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user