mperdeck/jsnlog.js

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

ribbles opened this issue · 1 comments

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'.

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