Compare commits

..

5 Commits

Author SHA1 Message Date
484e5d51cc 1.0.16 2018-11-04 18:44:28 +01:00
a8bac181a4 fix(core): update 2018-11-04 18:44:28 +01:00
76d3926ba4 1.0.15 2018-11-04 15:49:03 +01:00
0310c03ecb 1.0.14 2018-11-04 15:37:55 +01:00
9e8efc7dea fix(core): update 2018-11-04 15:37:55 +01:00
5 changed files with 29 additions and 20 deletions

8
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@mojoio/logdna",
"version": "1.0.13",
"version": "1.0.16",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -137,9 +137,9 @@
}
},
"@pushrocks/smartlog-interfaces": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.1.tgz",
"integrity": "sha512-c9onE52z/5fGX5uEvaI/rXbcC6n7PkLrNjehRM+6JsK7HIbdAzrgY1PGrqUfW0a03hSe03mFcggORID+fQI4tA=="
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-2.0.2.tgz",
"integrity": "sha512-kJNQ/6kfljgtwebhoiD8WtRWfdVhOoE1nr8FoUJLlOjLphU8SPa42Hg6/yPkSTaGxWwDhk6PkMJl64O7HNjRUQ=="
},
"@pushrocks/smartpath": {
"version": "4.0.1",

View File

@ -1,6 +1,6 @@
{
"name": "@mojoio/logdna",
"version": "1.0.13",
"version": "1.0.16",
"private": false,
"description": "anunoffical package for the logdna api",
"main": "dist/index.js",
@ -22,7 +22,7 @@
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/smartlog-interfaces": "^2.0.1",
"@pushrocks/smartlog-interfaces": "^2.0.2",
"@pushrocks/smartrequest": "^1.1.14",
"@pushrocks/smartstring": "^3.0.4",
"@pushrocks/taskbuffer": "^2.0.5"

View File

@ -14,6 +14,7 @@ tap.test('should create a valid logDna account', async () => {
tap.test('should create a standard log message', async () => {
testLogMessage = logdna.LogdnaMessage.fromSmartLogPackage({
timestamp: Date.now(),
type: 'log',
level: 'info',
context: {
@ -22,9 +23,9 @@ tap.test('should create a standard log message', async () => {
containerName: 'ci-mojoio-logdna',
environment: 'test',
runtime: 'node',
zone: 'ship.zone'
zone: 'shipzone'
},
message: 'this is an awesome log message :)'
message: 'this is an awesome log message sent by the tapbundle test'
});
});

View File

@ -6,6 +6,11 @@ import { TLogLevel, TEnvironment, ILogPackage } from '@pushrocks/smartlog-interf
* the constructor options for LogdnaMessage
*/
export interface ILogdnaMessageContructorOptions {
/**
* a timestamp for then the log message was created
*/
timestamp: number;
/**
* the hostname where the log message was created
*/
@ -62,6 +67,7 @@ export class LogdnaMessage {
*/
static fromSmartLogPackage(smartlogPackageArg: ILogPackage): LogdnaMessage {
return new LogdnaMessage({
timestamp: smartlogPackageArg.timestamp,
line: smartlogPackageArg.message,
meta: {
...smartlogPackageArg.context,
@ -70,7 +76,7 @@ export class LogdnaMessage {
env: smartlogPackageArg.context.environment,
hostname: smartlogPackageArg.context.zone,
level: smartlogPackageArg.level,
app: smartlogPackageArg.context.zone,
app: smartlogPackageArg.context.containerName,
tags: (() => {
const tagArray: string[] = [];
tagArray.push(smartlogPackageArg.context.company);

View File

@ -37,21 +37,23 @@ export class LogdnaAccount {
// let construct the request uri
const requestUrlWithParams = `${this.baseUrl}?hostname=${euc(lm.options.hostname)}&mac=${euc(
lm.options.mac
)}&ip=1${euc(lm.options.ip)}&now=${Date.now()}`;
const requestBodyObject = {
lines: [
{
line: lm.options.line,
app: lm.options.app,
level: lm.options.level,
env: lm.options.env,
meta: lm.options.meta,
tags: (() => {
)}&ip=1${euc(lm.options.ip)}&now=${Date.now()}&tags=${euc(
(() => {
return lm.options.tags.reduce((reduced, newItem) => {
return `${reduced},${newItem}`;
});
})()
)}`;
const requestBodyObject = {
lines: [
{
timestamp: lm.options.timestamp,
line: lm.options.line,
app: lm.options.app,
level: lm.options.level,
env: lm.options.env,
meta: lm.options.meta
}
]
};
@ -80,7 +82,7 @@ export class LogdnaAccount {
*/
public get smartlogDestination(): ILogDestination {
return {
handleLog: (logPackageArg) => {
handleLog: logPackageArg => {
this.sendSmartlogPackage(logPackageArg);
}
};