diff --git a/index.cjs.js b/index.cjs.js index 2baf6b2..422dd55 100644 --- a/index.cjs.js +++ b/index.cjs.js @@ -289,7 +289,11 @@ var ChainLogger = /*#__PURE__*/function (_LoggerBase) { _this = _super4.call(this); (0, _locustjsException.throwIfInstantiateAbstract)(ChainLogger, _assertThisInitialized(_this)); - (0, _locustjsException.throwIfNull)(next, 'next'); + + if ((0, _locustjsBase.isNull)(next)) { + next = new NullLogger(); + } + (0, _locustjsException.throwIfNotInstanceOf)('next', LoggerBase, next, true); _this.next = next; return _this; @@ -605,7 +609,7 @@ var DynamicLogger = /*#__PURE__*/function (_LoggerBase3) { } } } catch (e) { - this.error(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e)); + this.danger(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e)); } return result; diff --git a/index.esm.js b/index.esm.js index 9ac0e21..d0c6c4f 100644 --- a/index.esm.js +++ b/index.esm.js @@ -1,4 +1,4 @@ -import { isEmpty, isObject, isString, isSomeString, isFunction, isjQueryElement } from 'locustjs-base'; +import { isEmpty, isObject, isString, isSomeString, isFunction, isjQueryElement, isNull } from 'locustjs-base'; import { Exception, throwIfNull, @@ -127,7 +127,11 @@ class ChainLogger extends LoggerBase { super(); throwIfInstantiateAbstract(ChainLogger, this); - throwIfNull(next, 'next'); + + if (isNull(next)) { + next = new NullLogger(); + } + throwIfNotInstanceOf('next', LoggerBase, next, true); this.next = next; @@ -351,7 +355,7 @@ class DynamicLogger extends LoggerBase { } } } catch (e) { - this.error(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e)); + this.danger(new Log('danger', 'DynamicLogger._createLogger', type, this.options.host, e)); } return result; diff --git a/package.json b/package.json index 8077db9..1a4118e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "locustjs-logging", - "version": "1.0.6", + "version": "1.0.7", "description": "This library provides various types of loggers that could be employed in any type of front-end application.", "main": "index.cjs.js", "module": "index.esm.js",