From 8a9f7e672a6c9def10109554d629c178e0b0e367 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 21 Nov 2018 00:58:39 -0500 Subject: [PATCH] Fixes logging of static class methods --- src/logger.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/logger.ts b/src/logger.ts index 15828f4..5f04bed 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -219,11 +219,18 @@ export class Logger { } static toLoggableName(instance: Function | object) { + let name; if (typeof instance === 'function') { - return instance.name; + if (instance.prototype == null || instance.prototype.constructor == null) { + return instance.name; + } + + name = instance.prototype.constructor.name; + } + else { + name = instance.constructor != null ? instance.constructor.name : ''; } - const name = instance.constructor != null ? instance.constructor.name : ''; // Strip webpack module name (since I never name classes with an _) const index = name.indexOf('_'); return index === -1 ? name : name.substr(index + 1);