From 640eddae2d94487441890746bd4c6f109c2ca6d1 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 31 Oct 2018 18:51:54 +0100 Subject: [PATCH] fix(core): update --- ts/index.ts | 11 ++++++++++- ts/smartlog.classes.smartlog.ts | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ts/index.ts b/ts/index.ts index 471fb7a..4e2d37b 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,5 +1,14 @@ import * as plugins from './smartlog.plugins'; import { Smartlog } from './smartlog.classes.smartlog'; -const defaultLogger: Smartlog = new Smartlog(); +const defaultLogger: Smartlog = new Smartlog({ + logContext: { + company: 'undefined', + companyunit: 'undefefined', + containerName: 'undefined', + environment: 'local', + runtime: 'node', + zone: 'undefined' + } +}); export { Smartlog, defaultLogger }; diff --git a/ts/smartlog.classes.smartlog.ts b/ts/smartlog.classes.smartlog.ts index 827a0dd..5f416ae 100644 --- a/ts/smartlog.classes.smartlog.ts +++ b/ts/smartlog.classes.smartlog.ts @@ -5,16 +5,26 @@ import { TEnvironment, ILogContext, TLogLevel, TRuntime } from '@pushrocks/smart import { LogRouter } from './smartlog.classes.logrouter'; +export interface ISmartlogContructorOptions { + logContext: ILogContext; + minimumLogLevel?: TLogLevel; +} + export class Smartlog { private logContext: ILogContext; + private minimumLogLevel: TLogLevel; + private consoleEnabled: boolean; - private minimumLevel: TLogLevel; - private runtime: TRuntime; - + public logRouter = new LogRouter(); public addLogDestination = this.logRouter.addLogDestination; + constructor(optionsArg: ISmartlogContructorOptions) { + this.logContext = optionsArg.logContext; + this.minimumLogLevel = optionsArg.minimumLogLevel; + } + // ============ // Logger Setup