From 3409d488586cd4e99b687d27ff584ee55b14d528 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sat, 3 Mar 2018 13:57:55 +0100 Subject: [PATCH] system change --- package.json | 1 + ts/smartlog.classes.logrouter.ts | 14 ++++++++++ ts/smartlog.classes.smartlog.ts | 45 ++++++++++++++++---------------- yarn.lock | 34 ++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 ts/smartlog.classes.logrouter.ts diff --git a/package.json b/package.json index 66e9841..401618b 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "tapbundle": "^1.0.13" }, "dependencies": { + "smartlog-interfaces": "^1.0.4", "winston": "^3.0.0-rc1" }, "config": { diff --git a/ts/smartlog.classes.logrouter.ts b/ts/smartlog.classes.logrouter.ts new file mode 100644 index 0000000..7020699 --- /dev/null +++ b/ts/smartlog.classes.logrouter.ts @@ -0,0 +1,14 @@ +import * as plugins from './smartlog.plugins' + +import { + ILogDestination +} from 'smartlog-interfaces' + +export class LogRouter { + logDestinations: ILogDestination[] = []; + constructor() { + + } + + addLogDestination +} \ No newline at end of file diff --git a/ts/smartlog.classes.smartlog.ts b/ts/smartlog.classes.smartlog.ts index 52e33ab..0db9d58 100644 --- a/ts/smartlog.classes.smartlog.ts +++ b/ts/smartlog.classes.smartlog.ts @@ -1,19 +1,18 @@ import * as plugins from "./smartlog.plugins"; -export type TLogLevel = - | "error" - | "warn" - | "info" - | "verbose" - | "debug" - | "silly"; +// interfaces +import { + TEnvironment, + ILogContext, + TLogLevel, + TRuntime +} from 'smartlog-interfaces' export class Smartlog { - private winstonInstance = new plugins.winston.createLogger({ - level: "silly", - format: plugins.winston.format.json() - }); - + private logContext: ILogContext; + private consoleEnabled: boolean + private minimumLevel: TLogLevel + private runtime: TRuntime // ============ // Logger Setup // ============ @@ -21,16 +20,16 @@ export class Smartlog { /** * enables console logging */ - enableConsole() { - this.winstonInstance.add(new plugins.winston.transports.Console()); + enableConsole () { + this.consoleEnabled = true } /** * set a minimum serverity level to log * @param levelArg */ - level(levelArg: TLogLevel) { - this.winstonInstance.level(levelArg); + level (levelArg: TLogLevel) { + } // ============= @@ -41,27 +40,27 @@ export class Smartlog { * @param logLevelArg * @param logMessageArg */ - log(logLevelArg: TLogLevel, logMessageArg: string) { - this.winstonInstance.log(logLevelArg, logMessageArg); + log (logLevelArg: TLogLevel, logMessageArg: string) { + } - silly(logMessageArg: string) { + silly (logMessageArg: string) { this.log("silly", logMessageArg); } - debug(logMessageArg) { + debug (logMessageArg) { this.log("debug", logMessageArg); } - info(logMessageArg: string) { + info (logMessageArg: string) { this.log("info", logMessageArg); } - warn(logMessageArg) { + warn (logMessageArg) { this.log("warn", logMessageArg); } - error(logMessageArg) { + error (logMessageArg) { this.log("error", logMessageArg); } } diff --git a/yarn.lock b/yarn.lock index 5bdb430..32e829e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -71,6 +71,20 @@ colorspace@1.0.x: color "0.8.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: version "1.1.2" 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" 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: version "1.2.2" resolved "https://registry.yarnpkg.com/logform/-/logform-1.2.2.tgz#7be8847684de07185029ed09c65b11d06191ef93" @@ -197,6 +215,10 @@ logform@^1.2.1: colors "^1.1.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: version "0.3.0" 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" 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: version "1.0.8" resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.8.tgz#a074836f4ddd4b98c50f1e7ae9e8e8ad9f6f1902" @@ -246,6 +272,10 @@ smartdelay@^1.0.3: smartq "^1.1.1" 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: version "1.1.6" 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" triple-beam "^1.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"