Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: [BUG] #296

Open
rcl-official opened this issue Aug 22, 2024 · 2 comments
Open

Bug: [BUG] #296

rcl-official opened this issue Aug 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rcl-official
Copy link

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
'''

@rcl-official rcl-official added the bug Something isn't working label Aug 22, 2024
@terehov
Copy link
Contributor

terehov commented Aug 22, 2024

More context please on how to reproduce it.

@vernak2539
Copy link

vernak2539 commented Feb 10, 2025

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']
    });
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants