Skip to content
Snippets Groups Projects
Commit 7f849b35 authored by dakkar's avatar dakkar
Browse files

merge: refactor: Use proper logging facilities in WebfingerService (!615)

View MR for information: !615



Approved-by: default avatardakkar <dakkar@thenautilus.net>
Approved-by: default avatarMarie <github@yuugi.dev>
parents b211507a 6b88c4f1
No related branches found
No related tags found
2 merge requests!635Bump version,!615refactor: Use proper logging facilities in WebfingerService
Pipeline #1171 passed with stages
in 52 minutes and 42 seconds
......@@ -8,6 +8,8 @@ import { Injectable } from '@nestjs/common';
import { XMLParser } from 'fast-xml-parser';
import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js';
import type Logger from '@/logger.js';
import { RemoteLoggerService } from './RemoteLoggerService.js';
export type ILink = {
href: string;
......@@ -28,9 +30,13 @@ const defaultProtocol = process.env.MISSKEY_WEBFINGER_USE_HTTP?.toLowerCase() ==
@Injectable()
export class WebfingerService {
private logger: Logger;
constructor(
private httpRequestService: HttpRequestService,
private remoteLoggerService: RemoteLoggerService,
) {
this.logger = this.remoteLoggerService.logger.createSubLogger('webfinger');
}
@bindThis
......@@ -103,7 +109,7 @@ export class WebfingerService {
const template = (hostMeta['XRD']['Link'] as Array<any>).filter(p => p['@_rel'] === 'lrdd')[0]['@_template'];
return template.indexOf('{uri}') < 0 ? null : template;
} catch (err) {
console.error(`error while request host-meta for ${url}: ${err}`);
this.logger.error(`error while request host-meta for ${url}: ${err}`);
return null;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment