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

Using custom logger fails compilation due to version mismatch of the Logger #159

Open
derun-info opened this issue Aug 6, 2023 · 0 comments

Comments

@derun-info
Copy link

derun-info commented Aug 6, 2023

When trying to plug in a custom logger from std/log this error happens.

function logger() {
    return log.getLogger("db");
}

await mysql.configLogger({logger:logger()});
error: TS2322 [ERROR]: Type 'import("https://deno.land/[email protected]/log/logger.ts").Logger' is not assignable to type 'import("https://deno.land/[email protected]/log/logger.ts").Logger'.
  Property '#level' in type 'Logger' refers to a different member that cannot be accessed from within type 'Logger'.
await mysql.configLogger({ logger: logger() });
                           ~~~~~~
    at file:///.../db.ts:8:28

    The expected type comes from property 'logger' which is declared here on type 'LoggerConfig'
      logger?: log.Logger;
      ~~~~~~
        at https://deno.land/x/[email protected]/src/logger.ts:22:3

This parameter was not documented, but I assumed it was intended to be used like above. Is there a way to build it in some way that it is not so strict on the version incompatibility?

@derun-info derun-info changed the title Using custom logger fails compilation Using custom logger fails compilation due to version mismatch of the Logger Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant