Browse Source

Fixes logging of static class methods

main
Eric Amodio 6 years ago
parent
commit
8a9f7e672a
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      src/logger.ts

+ 9
- 2
src/logger.ts View File

@ -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);

Loading…
Cancel
Save