mirror of https://github.com/fantasticit/think.git
feat: improve log message
This commit is contained in:
parent
5f56dc0448
commit
8f9cecf277
|
@ -20,8 +20,7 @@ async function bootstrap() {
|
|||
app.useGlobalPipes(new ValidationPipe());
|
||||
app.setGlobalPrefix(config.get('server.prefix') || '/');
|
||||
await app.listen(config.get('server.port') || 4000);
|
||||
const url = await app.getUrl();
|
||||
console.log('服务启动成功:', url);
|
||||
console.log('[think] 主服务启动成功');
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
|
|
@ -63,14 +63,20 @@ export class CollaborationService {
|
|||
}
|
||||
|
||||
private async initServer() {
|
||||
const server = Server.configure({
|
||||
onAuthenticate: this.onAuthenticate.bind(this),
|
||||
onLoadDocument: this.onLoadDocument.bind(this),
|
||||
onChange: this.onChange.bind(this),
|
||||
onDisconnect: this.onDisconnect.bind(this),
|
||||
});
|
||||
this.server = server;
|
||||
this.server.listen(lodash.get(getConfig(), 'server.collaborationPort', 5003));
|
||||
try {
|
||||
const server = Server.configure({
|
||||
quiet: true,
|
||||
onAuthenticate: this.onAuthenticate.bind(this),
|
||||
onLoadDocument: this.onLoadDocument.bind(this),
|
||||
onChange: this.onChange.bind(this),
|
||||
onDisconnect: this.onDisconnect.bind(this),
|
||||
});
|
||||
this.server = server;
|
||||
await this.server.listen(lodash.get(getConfig(), 'server.collaborationPort', 5003));
|
||||
console.log('[think] 协作服务启动成功');
|
||||
} catch (err) {
|
||||
console.error('[think] 协作服务启动失败:', err.message);
|
||||
}
|
||||
}
|
||||
|
||||
async onAuthenticate({ connection, token, requestParameters }: onAuthenticatePayload) {
|
||||
|
|
|
@ -10,7 +10,7 @@ type VerisonDataItem = { version: string; data: string };
|
|||
export class DocumentVersionService {
|
||||
private redis: Redis;
|
||||
private max: number = 0;
|
||||
private error: string | null = '文档版本服务启动中';
|
||||
private error: string | null = '[think] 文档版本服务启动中';
|
||||
|
||||
constructor() {
|
||||
this.init();
|
||||
|
@ -41,16 +41,16 @@ export class DocumentVersionService {
|
|||
lazyConnect: true,
|
||||
});
|
||||
redis.on('ready', () => {
|
||||
console.log('文档版本服务启动成功');
|
||||
console.log('[think] 文档版本服务启动成功');
|
||||
this.redis = redis;
|
||||
this.error = null;
|
||||
});
|
||||
redis.on('error', (e) => {
|
||||
console.error(`Redis 启动失败: "${e}"`);
|
||||
console.error(`[think] Redis 启动失败: "${e}"`);
|
||||
});
|
||||
redis.connect().catch((e) => {
|
||||
this.redis = null;
|
||||
this.error = 'Redis 启动失败:无法提供文档版本服务';
|
||||
this.error = '[think] Redis 启动失败:无法提供文档版本服务';
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue