mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 43 forks source link

JL().setOptions({ "maxMessages": 50 }) Angular compile error #64

Closed ribbles closed 6 years ago

ribbles commented 6 years ago

jsnlog 2.26.1

JL().setOptions({ "maxMessages": 50 });

Gets a compile-time error:

ERROR in src/app/exception-handler.ts (4,19): Argument of type '{ "maxMessages": number; }' is not assignable to parameter of type 'JSNLogLoggerOptions'. Object literal may only specify known properties, and '"maxMessages"' does not exist in type 'JSNLogLoggerOptions'.

mperdeck commented 6 years ago

You are trying to set maxMessages on the nameless logger. However, loggers do not support that option. Only the library itself has that option.

Instead of writing: JL().setOptions({ "maxMessages": 50 }); // Wrong, tries to set maxMessages on a logger

Write this (without the () after the JL): JL.setOptions({ "maxMessages": 50 }); // Corrrect, sets maxMessages on the library

See http://jsnlog.com/Documentation/Configuration/JSNLog http://jsnlog.com/Documentation/Configuration/JSNLog/Logger