Skip to content

Commit b86b47c

Browse files
ColaFantapanva
andauthored
refactor: change new Debug() to debug() (#1363)
Co-authored-by: Filip Skokan <[email protected]>
1 parent e487fc3 commit b86b47c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

certification/runner/debug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import Debug from 'debug';
1+
import debug from 'debug';
22

33
if (!('DEBUG' in process.env)) {
44
process.env.DEBUG = 'runner';
55
}
66

7-
export default new Debug('runner');
7+
export default debug('runner');

lib/shared/authorization_error_handler.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import Debug from 'debug';
1+
import debug from 'debug';
22

33
import { InvalidRedirectUri } from '../helpers/errors.js';
44
import instance from '../helpers/weak_cache.js';
55
import errOut from '../helpers/err_out.js';
66
import resolveResponseMode from '../helpers/resolve_response_mode.js';
77
import oneRedirectUriClients from '../actions/authorization/one_redirect_uri_clients.js';
88

9-
const debug = new Debug('oidc-provider:authentication:error');
10-
const serverError = new Debug('oidc-provider:server_error');
11-
const serverErrorTrace = new Debug('oidc-provider:server_error:trace');
9+
const debugError = debug('oidc-provider:authentication:error');
10+
const serverError = debug('oidc-provider:server_error');
11+
const serverErrorTrace = debug('oidc-provider:server_error:trace');
1212

1313
export default (provider) => {
1414
const AD_ACTA_CHECKS = Object.entries({
@@ -25,7 +25,7 @@ export default (provider) => {
2525

2626
if (err.expose) {
2727
provider.emit('authorization.error', ctx, err);
28-
debug('%o', out);
28+
debugError('%o', out);
2929
} else {
3030
provider.emit('server_error', ctx, err);
3131
serverError('path=%s method=%s error=%o', ctx.path, ctx.method, err);

lib/shared/error_handler.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import * as crypto from 'node:crypto';
22

3-
import Debug from 'debug';
3+
import debug from 'debug';
44

55
import instance from '../helpers/weak_cache.js';
66
import * as formHtml from '../helpers/user_code_form.js';
77
import { ReRenderError } from '../helpers/re_render_errors.js';
88
import errOut from '../helpers/err_out.js';
99

10-
const debug = new Debug('oidc-provider:error');
11-
const serverError = new Debug('oidc-provider:server_error');
12-
const serverErrorTrace = new Debug('oidc-provider:server_error:trace');
10+
const debugError = debug('oidc-provider:error');
11+
const serverError = debug('oidc-provider:server_error');
12+
const serverErrorTrace = debug('oidc-provider:server_error:trace');
1313

1414
const userInputRoutes = new Set(['code_verification', 'device_resume']);
1515

@@ -26,7 +26,7 @@ export default function getErrorHandler(provider, eventName) {
2626
ctx.status = err.statusCode || 500;
2727

2828
if (err.expose && !(err instanceof ReRenderError)) {
29-
debug('path=%s method=%s error=%o detail=%s', ctx.path, ctx.method, out, err.error_detail);
29+
debugError('path=%s method=%s error=%o detail=%s', ctx.path, ctx.method, out, err.error_detail);
3030
} else if (!(err instanceof ReRenderError)) {
3131
serverError('path=%s method=%s error=%o', ctx.path, ctx.method, err);
3232
serverErrorTrace(err);

0 commit comments

Comments
 (0)