add log
This commit is contained in:
parent
d561a06ba2
commit
c5a73d57da
|
@ -65,6 +65,8 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
#sendApiError(reply: FastifyReply, err: ApiError): void {
|
||||
this.logger.error(err);
|
||||
|
||||
let statusCode = err.httpStatusCode;
|
||||
if (err.httpStatusCode === 401) {
|
||||
reply.header('WWW-Authenticate', 'Bearer realm="Misskey"');
|
||||
|
|
|
@ -62,6 +62,15 @@ export class ApiServerService {
|
|||
done();
|
||||
});
|
||||
|
||||
fastify.addHook('onSend', (request, reply, payload, next) => {
|
||||
console.log('---- Request:', request.method, request.url);
|
||||
console.log('---- body:', request.body);
|
||||
|
||||
console.log('---- Response:', reply.statusCode);
|
||||
console.log('---- Response:', payload);
|
||||
next();
|
||||
});
|
||||
|
||||
for (const endpoint of endpoints) {
|
||||
const ep = {
|
||||
name: endpoint.name,
|
||||
|
|
Loading…
Reference in New Issue