We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57d9683 commit 263ed42Copy full SHA for 263ed42
hooks/logging.ts
@@ -2,11 +2,12 @@ import { HookContext } from '@feathersjs/feathers';
2
3
export default async (context: HookContext): Promise<HookContext> => {
4
if (context.params.provider) {
5
- const { method, path, id, params: { user: { username }} } = context;
+ const { method, path, id } = context;
6
const timestamp = new Date().toLocaleString('default', { timeStyle: 'medium', dateStyle: 'short' });
7
const message = `${method.toUpperCase()}: /${path}/${id || ''}`;
8
+ const username = context.params.user?.username || 'anonymous';
9
- console.log(`[${timestamp}] ${message} ${username || ''}`);
10
+ console.log(`[${timestamp}] ${message} ${username}`);
11
}
12
return context;
13
};
0 commit comments