Compare commits

..

10 Commits

Author SHA1 Message Date
ade4d86597 2.0.2 2018-10-30 18:56:27 +01:00
d4cc9dbcd0 fix(core): implement log router 2018-10-30 18:56:26 +01:00
cde3686209 2.0.1 2018-07-10 22:36:53 +02:00
485e04c0b3 fix(.enableConsole()): now works 2018-07-10 22:36:53 +02:00
0ee2b8295a 2.0.0 2018-07-10 22:34:33 +02:00
4fd4de20c2 BREAKING CHANGE(core): now has simple defaultLogger 2018-07-10 22:34:33 +02:00
accf03f1b4 1.0.6 2018-07-08 22:30:22 +02:00
8e8e2c7bd6 fix(npm): package distribution 2018-07-08 22:30:21 +02:00
698d5927cc 1.0.5 2018-06-05 20:49:54 +02:00
3d8e2f881b fix(package): update package name 2018-06-05 20:49:54 +02:00
10 changed files with 981 additions and 263 deletions

View File

@ -26,6 +26,7 @@ mirror:
snyk:
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
@ -39,6 +40,7 @@ snyk:
testLEGACY:
stage: test
script:
- npmci npm prepare
- npmci node install legacy
- npmci npm install
- npmci npm test
@ -51,6 +53,7 @@ testLEGACY:
testLTS:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
@ -62,6 +65,7 @@ testLTS:
testSTABLE:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
@ -117,8 +121,10 @@ pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g npmpage
- npmci command npmpage
- npmci command npm install -g typedoc typescript
- npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- docker
- notpriv
@ -128,3 +134,14 @@ pages:
expire_in: 1 week
paths:
- public
allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true

View File

@ -1,8 +1,6 @@
{
"npmci": {
"npmGlobalTools": [
"npmts"
],
"npmGlobalTools": [],
"npmAccessLevel": "public"
}
}

1115
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "smartlog",
"version": "1.0.4",
"name": "@pushrocks/smartlog",
"version": "2.0.2",
"private": false,
"description": "winston based logger for large scale projects",
"main": "dist/index.js",
@ -8,16 +8,20 @@
"author": "Lossless GmbH",
"license": "UNLICENSED",
"scripts": {
"test": "(tsrun test/test.ts)",
"build": "echo \"Not needed for now\"",
"test": "(tstest test/)",
"build": "(tsbuild)",
"format": "(gitzone format)"
},
"devDependencies": {
"@gitzone/tsrun": "^1.0.4",
"cz-conventional-changelog": "^2.1.0",
"tapbundle": "^1.0.13"
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tsrun": "^1.1.13",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.12.1",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"smartlog-interfaces": "^1.0.4"
"@pushrocks/smartlog-interfaces": "^1.0.9"
}
}

View File

@ -1,10 +1,10 @@
import { expect, tap } from 'tapbundle';
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartlog from '../ts/index';
let defaultLogger: smartlog.Smartlog;
tap.test('should produce instance of Smartlog', async () => {
defaultLogger = smartlog.getDefaultLogger();
defaultLogger = smartlog.defaultLogger;
expect(defaultLogger).to.be.instanceOf(smartlog.Smartlog);
});

View File

@ -1,13 +1,5 @@
import * as plugins from './smartlog.plugins';
import { Smartlog } from './smartlog.classes.smartlog';
const defaultLogger: Smartlog = new Smartlog();
export { Smartlog };
let defaultLogger: Smartlog;
export const getDefaultLogger = () => {
if (!defaultLogger) {
defaultLogger = new Smartlog();
}
return defaultLogger;
};
export { Smartlog, defaultLogger };

View File

@ -1,10 +1,23 @@
import * as plugins from './smartlog.plugins';
import { ILogDestination } from 'smartlog-interfaces';
import { ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
export class LogRouter {
logDestinations: ILogDestination[] = [];
/**
* all log destinations
*/
private logDestinations: ILogDestination[] = [];
constructor() {}
addLogDestination;
public addLogDestination(logDestination: ILogDestination) {
this.logDestinations.push(logDestination);
}
// routes the log according to added logDestinations
routeLog(logPackageArg: ILogPackage) {
for (const logDestination of this.logDestinations) {
logDestination.handleLog(logPackageArg);
}
}
}

View File

@ -1,13 +1,21 @@
import * as plugins from './smartlog.plugins';
// interfaces
import { TEnvironment, ILogContext, TLogLevel, TRuntime } from 'smartlog-interfaces';
import { TEnvironment, ILogContext, TLogLevel, TRuntime } from '@pushrocks/smartlog-interfaces';
import { LogRouter } from './smartlog.classes.logrouter';
export class Smartlog {
private logContext: ILogContext;
private consoleEnabled: boolean;
private minimumLevel: TLogLevel;
private runtime: TRuntime;
public logRouter = new LogRouter();
public addLogDestination = this.logRouter.addLogDestination;
// ============
// Logger Setup
// ============
@ -33,25 +41,34 @@ export class Smartlog {
* @param logLevelArg
* @param logMessageArg
*/
log(logLevelArg: TLogLevel, logMessageArg: string) {}
public log(logLevelArg: TLogLevel, logMessageArg: string) {
if (this.consoleEnabled) {
console.log(`${logLevelArg}: ${logMessageArg}`);
}
this.logRouter.routeLog({
logContext: this.logContext,
logLevel: logLevelArg,
message: logMessageArg
});
}
silly(logMessageArg: string) {
public silly(logMessageArg: string) {
this.log('silly', logMessageArg);
}
debug(logMessageArg) {
public debug(logMessageArg) {
this.log('debug', logMessageArg);
}
info(logMessageArg: string) {
public info(logMessageArg: string) {
this.log('info', logMessageArg);
}
warn(logMessageArg) {
public warn(logMessageArg) {
this.log('warn', logMessageArg);
}
error(logMessageArg) {
public error(logMessageArg) {
this.log('error', logMessageArg);
}
}

View File

@ -1,3 +1,17 @@
{
"extends": "tslint-config-standard"
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}