darekf77 / ng2-logger

Isomorphic logger for Browser and NodeJS, ( typescript / javascript ) apps
MIT License
61 stars 17 forks source link

Error when using with Jasmine & Karma #23

Closed niros1 closed 7 years ago

niros1 commented 7 years ago

Hi, There is an error while using it with Karma:

ERROR in C:/Dev/GitLab/arya/node_modules/ng2-logger/src/log.ts (99,46): Property 'clear' does not exist on type 'Console'. C:/Dev/GitLab/arya/node_modules/ng2-logger/src/log.ts (100,13): Supplied parameters do not match any signature of call target. C:/Dev/GitLab/arya/node_modules/ng2-logger/src/log.ts (101,25): Property 'clear' does not exist on type 'Console'.

currently my workaround is to remove setProductionMode method. Appreciate if you can check the issue / share your thoughts.

Nir.

darekf77 commented 7 years ago

in nodejs console.clear() does not exist... it is only in the browser. Do not use isProductionMode() with karma/jasmine... try this configuration on production mode for .(karma.conf.js) :

...
    /*
     * level of logging
     * possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
     */
    logLevel: config.LOG_DISABLE
...
niros1 commented 7 years ago

This is a compile time issue. we fixed it by adding the dom library to the tsconfig.spec.json

"lib": [ "es2016", "dom" ],