system change

This commit is contained in:
Philipp Kunz 2018-03-03 13:57:55 +01:00
parent 02070b9c26
commit 3409d48858
4 changed files with 71 additions and 23 deletions

View File

@ -15,6 +15,7 @@
"tapbundle": "^1.0.13" "tapbundle": "^1.0.13"
}, },
"dependencies": { "dependencies": {
"smartlog-interfaces": "^1.0.4",
"winston": "^3.0.0-rc1" "winston": "^3.0.0-rc1"
}, },
"config": { "config": {

View File

@ -0,0 +1,14 @@
import * as plugins from './smartlog.plugins'
import {
ILogDestination
} from 'smartlog-interfaces'
export class LogRouter {
logDestinations: ILogDestination[] = [];
constructor() {
}
addLogDestination
}

View File

@ -1,19 +1,18 @@
import * as plugins from "./smartlog.plugins"; import * as plugins from "./smartlog.plugins";
export type TLogLevel = // interfaces
| "error" import {
| "warn" TEnvironment,
| "info" ILogContext,
| "verbose" TLogLevel,
| "debug" TRuntime
| "silly"; } from 'smartlog-interfaces'
export class Smartlog { export class Smartlog {
private winstonInstance = new plugins.winston.createLogger({ private logContext: ILogContext;
level: "silly", private consoleEnabled: boolean
format: plugins.winston.format.json() private minimumLevel: TLogLevel
}); private runtime: TRuntime
// ============ // ============
// Logger Setup // Logger Setup
// ============ // ============
@ -22,7 +21,7 @@ export class Smartlog {
* enables console logging * enables console logging
*/ */
enableConsole () { enableConsole () {
this.winstonInstance.add(new plugins.winston.transports.Console()); this.consoleEnabled = true
} }
/** /**
@ -30,7 +29,7 @@ export class Smartlog {
* @param levelArg * @param levelArg
*/ */
level (levelArg: TLogLevel) { level (levelArg: TLogLevel) {
this.winstonInstance.level(levelArg);
} }
// ============= // =============
@ -42,7 +41,7 @@ export class Smartlog {
* @param logMessageArg * @param logMessageArg
*/ */
log (logLevelArg: TLogLevel, logMessageArg: string) { log (logLevelArg: TLogLevel, logMessageArg: string) {
this.winstonInstance.log(logLevelArg, logMessageArg);
} }
silly (logMessageArg: string) { silly (logMessageArg: string) {

View File

@ -71,6 +71,20 @@ colorspace@1.0.x:
color "0.8.x" color "0.8.x"
text-hex "0.0.x" text-hex "0.0.x"
conventional-commit-types@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/conventional-commit-types/-/conventional-commit-types-2.2.0.tgz#5db95739d6c212acbe7b6f656a11b940baa68946"
cz-conventional-changelog@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-2.1.0.tgz#2f4bc7390e3244e4df293e6ba351e4c740a7c764"
dependencies:
conventional-commit-types "^2.0.0"
lodash.map "^4.5.1"
longest "^1.0.1"
right-pad "^1.0.1"
word-wrap "^1.0.3"
define-properties@^1.1.2: define-properties@^1.1.2:
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
@ -190,6 +204,10 @@ left-pad@^1.1.3:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
lodash.map@^4.5.1:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
logform@^1.2.1: logform@^1.2.1:
version "1.2.2" version "1.2.2"
resolved "https://registry.yarnpkg.com/logform/-/logform-1.2.2.tgz#7be8847684de07185029ed09c65b11d06191ef93" resolved "https://registry.yarnpkg.com/logform/-/logform-1.2.2.tgz#7be8847684de07185029ed09c65b11d06191ef93"
@ -197,6 +215,10 @@ logform@^1.2.1:
colors "^1.1.2" colors "^1.1.2"
fecha "^2.3.2" fecha "^2.3.2"
longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
memwatch-next@^0.3.0: memwatch-next@^0.3.0:
version "0.3.0" version "0.3.0"
resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f" resolved "https://registry.yarnpkg.com/memwatch-next/-/memwatch-next-0.3.0.tgz#2111050f9a906e0aa2d72a4ec0f0089c78726f8f"
@ -231,6 +253,10 @@ pretty-bytes@^4.0.2:
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9"
right-pad@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0"
smartchai@^1.0.3: smartchai@^1.0.3:
version "1.0.8" version "1.0.8"
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.8.tgz#a074836f4ddd4b98c50f1e7ae9e8e8ad9f6f1902" resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.8.tgz#a074836f4ddd4b98c50f1e7ae9e8e8ad9f6f1902"
@ -246,6 +272,10 @@ smartdelay@^1.0.3:
smartq "^1.1.1" smartq "^1.1.1"
typings-global "^1.0.16" typings-global "^1.0.16"
smartlog-interfaces@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/smartlog-interfaces/-/smartlog-interfaces-1.0.4.tgz#d1c25139e644013b21484a7bd233161bdc50065e"
smartq@^1.1.1: smartq@^1.1.1:
version "1.1.6" version "1.1.6"
resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412" resolved "https://registry.yarnpkg.com/smartq/-/smartq-1.1.6.tgz#0c1ff4336d95e95b4f1fdd8ccd7e2c5a323b8412"
@ -304,3 +334,7 @@ winston@^3.0.0-rc1:
stack-trace "0.0.x" stack-trace "0.0.x"
triple-beam "^1.0.1" triple-beam "^1.0.1"
winston-transport "^3.0.1" winston-transport "^3.0.1"
word-wrap@^1.0.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"