aboutsummaryrefslogtreecommitdiff
path: root/hooks/logging.ts
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-25 21:25:18 +0300
committereug-vs <eug-vs@keemail.me>2020-06-25 21:25:18 +0300
commitfd484a217c77dba42c29fae1cfdb2390422da847 (patch)
treeb11c527bbc0a268f0361a4d56f6aff7011960f98 /hooks/logging.ts
parent050d3e087b3ce2c9dd892a96daf215402292aa2c (diff)
downloadwhich-api-fd484a217c77dba42c29fae1cfdb2390422da847.tar.gz
feat: add logger and handle eveyrthing nicely
Diffstat (limited to 'hooks/logging.ts')
-rw-r--r--hooks/logging.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/hooks/logging.ts b/hooks/logging.ts
index 840873c..8babe9a 100644
--- a/hooks/logging.ts
+++ b/hooks/logging.ts
@@ -1,13 +1,13 @@
import { HookContext } from '@feathersjs/feathers';
+import logger from '../logger';
export default async (context: HookContext): Promise<HookContext> => {
if (context.params.provider) {
const { method, path, id } = context;
- const timestamp = new Date().toLocaleString('default', { timeStyle: 'medium', dateStyle: 'short' });
const message = `${method.toUpperCase()}: /${path}/${id || ''}`;
const username = context.params.user?.username || 'anonymous';
- console.log(`[${timestamp}] ${message} ${username}`);
+ logger.log(`${message} ${username}`);
}
return context;
};