Truncate log messages in html so it doesn\'t kill phones. Fix id in log message
This commit is contained in:
@@ -31,7 +31,8 @@ export function log(...args: any[]): any {
|
|||||||
|
|
||||||
let logLine = `[${new Date().toLocaleTimeString()}]: `;
|
let logLine = `[${new Date().toLocaleTimeString()}]: `;
|
||||||
for (let arg of args) {
|
for (let arg of args) {
|
||||||
logLine += (typeof arg === "string" || arg instanceof String) ? arg : JSON.stringify(arg, null, 4);
|
let completeLine = (typeof arg === "string" || arg instanceof String) ? arg : JSON.stringify(arg, null, 4);
|
||||||
|
logLine += completeLine.substring(0, 500);
|
||||||
}
|
}
|
||||||
logLines.push(logLine + "\n");
|
logLines.push(logLine + "\n");
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ class App {
|
|||||||
|
|
||||||
|
|
||||||
for (let post of posts) {
|
for (let post of posts) {
|
||||||
console.log.apply(null, log(`[app] sendPostForUser sending post [${logID(post.id)}] to [${logID(requestingPeerID)}]`, userID, post));
|
console.log.apply(null, log(`[app] sendPostForUser sending post [${logID(post.post_id)}] to [${logID(requestingPeerID)}]`, userID, post));
|
||||||
|
|
||||||
this.peerManager?.rpc.sendPostForUser(requestingPeerID, userID, post);
|
this.peerManager?.rpc.sendPostForUser(requestingPeerID, userID, post);
|
||||||
}
|
}
|
||||||
@@ -362,7 +362,7 @@ class App {
|
|||||||
clearTimeout(this.renderTimer);
|
clearTimeout(this.renderTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderTimer = setTimeout(()=>{this.render()}, 1000)
|
this.renderTimer = setTimeout(()=>{this.render()}, 200);
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class App {
|
|||||||
this.peerManager.registerRPC('getPostsForUser', async (requestingPeerID, userID, postIDs) => {
|
this.peerManager.registerRPC('getPostsForUser', async (requestingPeerID, userID, postIDs) => {
|
||||||
let posts = await this.sync.getPostsForUser(userID, postIDs);
|
let posts = await this.sync.getPostsForUser(userID, postIDs);
|
||||||
for (let post of posts) {
|
for (let post of posts) {
|
||||||
console.log.apply(null, log(`[app] sendPostForUser sending post [${logID(post.id)}] to [${logID(requestingPeerID)}]`, userID, post));
|
console.log.apply(null, log(`[app] sendPostForUser sending post [${logID(post.post_id)}] to [${logID(requestingPeerID)}]`, userID, post));
|
||||||
this.peerManager?.rpc.sendPostForUser(requestingPeerID, userID, post);
|
this.peerManager?.rpc.sendPostForUser(requestingPeerID, userID, post);
|
||||||
}
|
}
|
||||||
// return posts;
|
// return posts;
|
||||||
@@ -217,7 +217,7 @@ class App {
|
|||||||
if (this.renderTimer) {
|
if (this.renderTimer) {
|
||||||
clearTimeout(this.renderTimer);
|
clearTimeout(this.renderTimer);
|
||||||
}
|
}
|
||||||
this.renderTimer = setTimeout(() => { this.render(); }, 1000);
|
this.renderTimer = setTimeout(() => { this.render(); }, 200);
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
await this.peerManager.connect();
|
await this.peerManager.connect();
|
||||||
|
|||||||
Reference in New Issue
Block a user