tslog
tslog copied to clipboard
Bug: [BUG]
Describe the bug I'm using the plasmo framework to write a chrome extension, while i want to introduce the tslog to handle my logging issue. And I found
''' Uncaught TypeError: (0 , _tslog.Logger) is not a constructor '''
More context please on how to reproduce it.
I ran into the same problem using plasmo. I ended up having to do something like this to get it to work.. I've not had too much time to dig into why it's needed, but hopefully this helps someone...
import type { ILogObj, Logger as LoggerType } from "tslog";
import * as tslog from "tslog/dist/esm/index.js";
const { Logger } = tslog;
class BrowserLogger {
contexts: [string, string][];
logger: LoggerType<ILogObj>;
constructor(source: ExtensionFileSource) {
this.logger = new Logger({
prefix: ['prefix']
});
}
}