Describe the issue
I haven't been all that satisfied with how MetadataService handles logging, so it's been a no-op for over two years now:
|
export function getLogger(_name: string): (message: string, ..._rest: unknown[]) => void { |
|
// This is a noop for now while I search for a better debug logger technique |
|
return (_message, ..._rest) => {}; |
|
} |
I researched alternative solutions and landed on a solution: update MetadataService.initialize() to accept a new "Logger" object that allows the project using SimpleWebAuthn to capture logs appropriate to its setup, without having to accommodate any library-specific solution.
The interface would look something like this:
interface Logger {
debug: (message: string, ...args: unknown[]) => void;
info: (message: string, ...args: unknown[]) => void;
warning: (message: string, ...args: unknown[]) => void;
error: (message: string, ...args: unknown[]) => void;
}
Describe the issue
I haven't been all that satisfied with how MetadataService handles logging, so it's been a no-op for over two years now:
SimpleWebAuthn/packages/server/src/helpers/logging.ts
Lines 17 to 20 in 78ad52f
I researched alternative solutions and landed on a solution: update
MetadataService.initialize()to accept a new "Logger" object that allows the project using SimpleWebAuthn to capture logs appropriate to its setup, without having to accommodate any library-specific solution.The interface would look something like this: