Repository: svg-sprite/svg-sprite (js)

Issue:
Passing winston logger to config causes Error
```
const log = winston.createLogger();
const config = new SVGSpriterConfig({
    log,
});
```
throws
```
Uncaught TypeError: Function has non-object prototype 'undefined' in instanceof check
    at Function.[Symbol.hasInstance] (<anonymous>)
```
Because `winston.Logger` has no constructor

Pull request description:
fix: checking passed config.log to be instance of winston.Logger
Fixes #626

Patch:
diff --git a/lib/svg-sprite/config.js b/lib/svg-sprite/config.js
index 0d02885..13ba3e4 100644
--- a/lib/svg-sprite/config.js
+++ b/lib/svg-sprite/config.js
@@ -18,7 +18,7 @@ const { isFunction, isObject, isPlainObject, isString } = require('./utils/index
 /**
  * Sprite types
  *
- * @type {Array}
+ * @type {Set<string>}
  */
 const spriteTypes = new Set(['css', 'view', 'defs', 'symbol', 'stack']);
 
@@ -85,6 +85,19 @@ const defaultSVGConfig = {
     precision: -1
 };
 
+/**
+ * @param {any} logger  probable logger
+ * @returns {boolean}   result
+ */
+const isWinstonLogger = logger => {
+    return (
+        isObject(logger) &&
+        logger.level !== undefined &&
+        Array.isArray(logger.transports) &&
+        isFunction(logger.log)
+    );
+};
+
 /**
  * SVGSpriter configuration
  *
@@ -95,7 +108,7 @@ function SVGSpriterConfig(config) {
     this.log = '';
 
     if ('log' in config) {
-        if (config.log instanceof winston.Logger || (isObject(config.log) && config.log.level !== undefined && isObject(config.log.transports) && isFunction(config.log.log))) {
+        if (isWinstonLogger(config.log)) {
             this.log = config.log;
         } else {
             this.log = isString(config.log) && ['info', 'verbose', 'debug'].includes(config.log) ? config.log : (config.log ? 'info' : '');


Test patch:
diff --git a/test/svg-sprite/config.test.js b/test/svg-sprite/config.test.js
new file mode 100644
index 0000000..35ff449
--- /dev/null
+++ b/test/svg-sprite/config.test.js
@@ -0,0 +1,26 @@
+'use strict';
+
+const winston = require('winston');
+const SVGSpriterConfig = require('../../lib/svg-sprite/config.js');
+
+describe('testing constructor', () => {
+    describe('testing log', () => {
+        it('should set winston logger', () => {
+            expect.hasAssertions();
+
+            const TEST_LOGGER = winston.createLogger({
+                transports: [
+                    new winston.transports.Console({
+                        level: 'info'
+                    })
+                ],
+                level: 'info'
+            });
+            const config = new SVGSpriterConfig({
+                log: TEST_LOGGER
+            });
+
+            expect(config.log).toStrictEqual(TEST_LOGGER);
+        });
+    });
+});