fix(core): update

This commit is contained in:
Philipp Kunz 2020-07-10 00:28:54 +00:00
parent 0a3222ce9a
commit 690c4a9020
10 changed files with 1211 additions and 581 deletions

2
dist_ts/beautybrowser.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces';
export { smartlogInterfaces };

View File

@ -0,0 +1,25 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.smartlogInterfaces = void 0;
const smartlogInterfaces = __importStar(require("@pushrocks/smartlog-interfaces"));
exports.smartlogInterfaces = smartlogInterfaces;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5YnJvd3Nlci5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5YnJvd3Nlci5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxtRkFBcUU7QUFDNUQsZ0RBQWtCIn0=

5
dist_ts/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
export declare class SmartlogDestinationDevtools implements ILogDestination {
handleLog(logPackageArg: ILogPackage): Promise<void>;
private logInBrowser;
}

35
dist_ts/index.js Normal file
View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmartlogDestinationDevtools = void 0;
class SmartlogDestinationDevtools {
async handleLog(logPackageArg) {
await this.logInBrowser(logPackageArg);
}
async logInBrowser(logPackage) {
switch (logPackage.level) {
case 'error':
console.log(`%c Error: %c ${logPackage.message}`, 'background:#000000;color:#800000;', 'color:#000000;');
break;
case 'info':
console.log(`%c Info: %c ${logPackage.message}`, 'background:#EC407A;color:#ffffff;', 'color:#EC407A;');
break;
case 'ok':
console.log(`%c OK: %c ${logPackage.message}`, 'background:#000000;color:#8BC34A;', 'color:#000000;');
break;
case 'success':
console.log(`%c Success: %c ${logPackage.message}`, 'background:#8BC34A;color:#ffffff;', 'color:#8BC34A;');
break;
case 'warn':
console.log(`%c Warn: %c ${logPackage.message}`, 'background:#000000;color:#FB8C00;', 'color:#000000;');
break;
case 'note':
console.log(`%c Note: %c ${logPackage.message}`, 'background:#42A5F5;color:#ffffff', 'color:#42A5F5;');
break;
default:
console.log(`unknown logType for "${logPackage.message}"`);
break;
}
}
}
exports.SmartlogDestinationDevtools = SmartlogDestinationDevtools;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSxNQUFhLDJCQUEyQjtJQUMvQixLQUFLLENBQUMsU0FBUyxDQUFDLGFBQTBCO1FBQy9DLE1BQU0sSUFBSSxDQUFDLFlBQVksQ0FBQyxhQUFhLENBQUMsQ0FBQztJQUN6QyxDQUFDO0lBRU8sS0FBSyxDQUFDLFlBQVksQ0FBQyxVQUF1QjtRQUNoRCxRQUFRLFVBQVUsQ0FBQyxLQUFLLEVBQUU7WUFDeE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BQ1Q7SUFDSCxDQUFDO0NBQ0Y7QUF0REQsa0VBc0RDIn0=

1666
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,21 +8,21 @@
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/ --web)",
"testBrowser": "(parcel ./test/index.html)", "testBrowser": "(parcel ./test/index.html)",
"build": "(tsbuild)" "build": "(tsbuild --web)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.33", "@gitzone/tstest": "^1.0.40",
"@pushrocks/smartlog": "^2.0.21", "@pushrocks/smartlog": "^2.0.35",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.7",
"@types/node": "^14.0.11", "@types/node": "^14.0.20",
"parcel-bundler": "^1.12.4", "parcel-bundler": "^1.12.4",
"tslint": "^6.1.2", "tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartlog-interfaces": "^2.0.15" "@pushrocks/smartlog-interfaces": "^2.0.20"
} }
} }

View File

@ -1,26 +0,0 @@
// preparation
import { ILogContext } from '@pushrocks/smartlog-interfaces';
import * as smartlog from '@pushrocks/smartlog';
const logger = smartlog.defaultLogger;
const logContext: ILogContext = {
company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud',
containerName: 'testContainer',
environment: 'staging',
runtime: 'chrome',
zone: 'servezone'
};
// import the module to test
import * as smartlogDestinationDevtools from '../ts/index';
const testDestination = new smartlogDestinationDevtools.SmartlogDestinationDevtools();
testDestination.handleLog({
timestamp: Date.now(),
type: 'log',
context: logContext,
level: 'info',
message: 'wait, what? Hi, this is a message!'
});

View File

@ -1,4 +0,0 @@
<head>
<script src="./browsertest.ts"></script>
</head>
<body></body>

View File

@ -4,7 +4,6 @@ import { expect, tap } from '@pushrocks/tapbundle';
import { ILogContext } from '@pushrocks/smartlog-interfaces'; import { ILogContext } from '@pushrocks/smartlog-interfaces';
import * as smartlog from '@pushrocks/smartlog'; import * as smartlog from '@pushrocks/smartlog';
const logger = smartlog.defaultLogger;
const logContext: ILogContext = { const logContext: ILogContext = {
company: 'Lossless GmbH', company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud', companyunit: 'Lossless.Cloud',
@ -14,6 +13,10 @@ const logContext: ILogContext = {
zone: 'servezone' zone: 'servezone'
}; };
const logger = new smartlog.Smartlog({
logContext
});
// import the module to test // import the module to test
import * as smartlogDestinationDevtools from '../ts/index'; import * as smartlogDestinationDevtools from '../ts/index';

View File

@ -3,11 +3,11 @@ import { ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
export class SmartlogDestinationDevtools implements ILogDestination { export class SmartlogDestinationDevtools implements ILogDestination {
public handleLog(logPackageArg: ILogPackage) { public async handleLog(logPackageArg: ILogPackage) {
this.logInBrowser(logPackageArg); await this.logInBrowser(logPackageArg);
} }
private logInBrowser(logPackage: ILogPackage) { private async logInBrowser(logPackage: ILogPackage) {
switch (logPackage.level) { switch (logPackage.level) {
case 'error': case 'error':
console.log( console.log(