Better logging
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import * as mongo from 'mongodb';
|
||||
import * as debug from 'debug';
|
||||
|
||||
import config from '../../../config';
|
||||
import Resolver from '../resolver';
|
||||
@@ -16,8 +15,9 @@ import { toUnicode } from 'punycode';
|
||||
import { unique, concat, difference } from '../../../prelude/array';
|
||||
import { extractPollFromQuestion } from './question';
|
||||
import vote from '../../../services/note/polls/vote';
|
||||
import { apLogger } from '../logger';
|
||||
|
||||
const log = debug('misskey:activitypub');
|
||||
const logger = apLogger;
|
||||
|
||||
/**
|
||||
* Noteをフェッチします。
|
||||
@@ -53,13 +53,13 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
||||
const object = await resolver.resolve(value) as any;
|
||||
|
||||
if (object == null || object.type !== 'Note') {
|
||||
log(`invalid note: ${object}`);
|
||||
logger.error(`invalid note: ${object}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
const note: INoteActivityStreamsObject = object;
|
||||
|
||||
log(`Creating the Note: ${note.id}`);
|
||||
logger.info(`Creating the Note: ${note.id}`);
|
||||
|
||||
// 投稿者をフェッチ
|
||||
const actor = await resolvePerson(note.attributedTo, null, resolver) as IRemoteUser;
|
||||
@@ -116,14 +116,14 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
||||
if (reply && reply.poll && text != null) {
|
||||
const m = text.match(/([0-9])$/);
|
||||
if (m) {
|
||||
log(`vote from AP: actor=${actor.username}@${actor.host}, note=${note.id}, choice=${m[0]}`);
|
||||
logger.info(`vote from AP: actor=${actor.username}@${actor.host}, note=${note.id}, choice=${m[0]}`);
|
||||
await vote(actor, reply, Number(m[1]));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const emojis = await extractEmojis(note.tag, actor.host).catch(e => {
|
||||
console.log(`extractEmojis: ${e}`);
|
||||
logger.info(`extractEmojis: ${e}`);
|
||||
return [] as IEmoji[];
|
||||
});
|
||||
|
||||
@@ -215,7 +215,7 @@ export async function extractEmojis(tags: ITag[], host_: string) {
|
||||
return exists;
|
||||
}
|
||||
|
||||
log(`register emoji host=${host}, name=${name}`);
|
||||
logger.info(`register emoji host=${host}, name=${name}`);
|
||||
|
||||
return await Emoji.insert({
|
||||
host,
|
||||
|
Reference in New Issue
Block a user