denodrivers/mysql

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

derun-info opened this issue · 0 comments

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/std@0.197.0/log/logger.ts").Logger' is not assignable to type 'import("https://deno.land/std@0.104.0/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/mysql@v2.11.0/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?