summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/logging.ts
blob: 2a8b67e0460d4619b60648d23a8083189f57e16e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import debug, { Debugger } from 'debug';

const defaultLogger = debug('SimpleWebAuthn');

/**
 * Generate an instance of a `debug` logger that extends off of the "simplewebauthn" namespace for
 * consistent naming.
 *
 * See https://www.npmjs.com/package/debug for information on how to control logging output when
 * using @simplewebauthn/server
 *
 * Example:
 *
 * ```
 * const log = getLogger('mds');
 * log('hello'); // simplewebauthn:mds hello +0ms
 * ```
 */
export function getLogger(name: string): Debugger {
  return defaultLogger.extend(name);
}