Import log instead of using it off of window
This commit is contained in:
parent
8eb0dd3116
commit
65ddf0a9e8
155 changed files with 3654 additions and 3433 deletions
|
@ -15,7 +15,8 @@ import {
|
|||
|
||||
import { MessageModel } from '../models/messages';
|
||||
import { AttachmentType } from '../types/Attachment';
|
||||
import { LoggerType } from '../window.d';
|
||||
import { LoggerType } from '../types/Logging';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
const {
|
||||
getMessageById,
|
||||
|
@ -179,7 +180,7 @@ async function _maybeStartJob(): Promise<void> {
|
|||
|
||||
async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
||||
if (!job) {
|
||||
window.log.warn('_runJob: Job was missing!');
|
||||
log.warn('_runJob: Job was missing!');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { Collection, Model } from 'backbone';
|
||||
import { MessageModel } from '../models/messages';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
type DeleteAttributesType = {
|
||||
targetSentTimestamp: number;
|
||||
|
@ -34,7 +35,7 @@ export class Deletes extends Collection<DeleteModel> {
|
|||
});
|
||||
|
||||
if (matchingDeletes.length > 0) {
|
||||
window.log.info('Found early DOE for message');
|
||||
log.info('Found early DOE for message');
|
||||
this.remove(matchingDeletes);
|
||||
return matchingDeletes;
|
||||
}
|
||||
|
@ -52,7 +53,7 @@ export class Deletes extends Collection<DeleteModel> {
|
|||
);
|
||||
|
||||
if (!targetConversation) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'No target conversation for DOE',
|
||||
del.get('fromId'),
|
||||
del.get('targetSentTimestamp')
|
||||
|
@ -63,7 +64,7 @@ export class Deletes extends Collection<DeleteModel> {
|
|||
|
||||
// Do not await, since this can deadlock the queue
|
||||
targetConversation.queueJob('Deletes.onDelete', async () => {
|
||||
window.log.info('Handling DOE for', del.get('targetSentTimestamp'));
|
||||
log.info('Handling DOE for', del.get('targetSentTimestamp'));
|
||||
|
||||
const messages = await window.Signal.Data.getMessagesBySentAt(
|
||||
del.get('targetSentTimestamp'),
|
||||
|
@ -77,7 +78,7 @@ export class Deletes extends Collection<DeleteModel> {
|
|||
);
|
||||
|
||||
if (!targetMessage) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'No message for DOE',
|
||||
del.get('fromId'),
|
||||
del.get('targetSentTimestamp')
|
||||
|
@ -96,7 +97,7 @@ export class Deletes extends Collection<DeleteModel> {
|
|||
this.remove(del);
|
||||
});
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
log.error(
|
||||
'Deletes.onDelete error:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
} from '../messages/MessageSendState';
|
||||
import type { DeleteSentProtoRecipientOptionsType } from '../sql/Interface';
|
||||
import dataInterface from '../sql/Client';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
const { deleteSentProtoRecipient } = dataInterface;
|
||||
|
||||
|
@ -47,7 +48,7 @@ const deleteSentProtoBatcher = createWaitBatcher({
|
|||
wait: 250,
|
||||
maxSize: 30,
|
||||
async processBatch(items: Array<DeleteSentProtoRecipientOptionsType>) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
`MessageReceipts: Batching ${items.length} sent proto recipients deletes`
|
||||
);
|
||||
await deleteSentProtoRecipient(items);
|
||||
|
@ -125,7 +126,7 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
|||
ids.includes(receipt.get('sourceConversationId'))
|
||||
);
|
||||
if (receipts.length) {
|
||||
window.log.info('Found early receipts for message');
|
||||
log.info('Found early receipts for message');
|
||||
this.remove(receipts);
|
||||
}
|
||||
return receipts;
|
||||
|
@ -146,7 +147,7 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
|||
|
||||
const message = await getTargetMessage(sourceConversationId, messages);
|
||||
if (!message) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'No message for receipt',
|
||||
type,
|
||||
sourceConversationId,
|
||||
|
@ -222,7 +223,7 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
|||
deviceId,
|
||||
});
|
||||
} else {
|
||||
window.log.warn(
|
||||
log.warn(
|
||||
`MessageReceipts.onReceipt: Missing uuid or deviceId for deliveredTo ${sourceConversationId}`
|
||||
);
|
||||
}
|
||||
|
@ -230,7 +231,7 @@ export class MessageReceipts extends Collection<MessageReceiptModel> {
|
|||
|
||||
this.remove(receipt);
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
log.error(
|
||||
'MessageReceipts.onReceipt error:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { Collection, Model } from 'backbone';
|
||||
import { ConversationModel } from '../models/conversations';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
type MessageRequestAttributesType = {
|
||||
threadE164?: string;
|
||||
|
@ -33,7 +34,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
threadE164: conversation.get('e164'),
|
||||
});
|
||||
if (syncByE164) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
`Found early message request response for E164 ${conversation.idForLogging()}`
|
||||
);
|
||||
this.remove(syncByE164);
|
||||
|
@ -46,7 +47,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
threadUuid: conversation.get('uuid'),
|
||||
});
|
||||
if (syncByUuid) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
`Found early message request response for UUID ${conversation.idForLogging()}`
|
||||
);
|
||||
this.remove(syncByUuid);
|
||||
|
@ -60,7 +61,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
groupId: conversation.get('groupId'),
|
||||
});
|
||||
if (syncByGroupId) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
`Found early message request response for group v1 ID ${conversation.idForLogging()}`
|
||||
);
|
||||
this.remove(syncByGroupId);
|
||||
|
@ -74,7 +75,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
groupV2Id: conversation.get('groupId'),
|
||||
});
|
||||
if (syncByGroupId) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
`Found early message request response for group v2 ID ${conversation.idForLogging()}`
|
||||
);
|
||||
this.remove(syncByGroupId);
|
||||
|
@ -111,7 +112,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
}
|
||||
|
||||
if (!conversation) {
|
||||
window.log.warn(
|
||||
log.warn(
|
||||
`Received message request response for unknown conversation: groupv2(${groupV2Id}) group(${groupId}) ${threadUuid} ${threadE164}`
|
||||
);
|
||||
return;
|
||||
|
@ -123,7 +124,7 @@ export class MessageRequests extends Collection<MessageRequestModel> {
|
|||
|
||||
this.remove(sync);
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
log.error(
|
||||
'MessageRequests.onResponse error:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
|
|
|
@ -7,6 +7,7 @@ import { Collection, Model } from 'backbone';
|
|||
import { MessageModel } from '../models/messages';
|
||||
import { isOutgoing } from '../state/selectors/message';
|
||||
import { ReactionAttributesType } from '../model-types.d';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
export class ReactionModel extends Model<ReactionAttributesType> {}
|
||||
|
||||
|
@ -28,7 +29,7 @@ export class Reactions extends Collection {
|
|||
);
|
||||
|
||||
if (outgoingReactions.length > 0) {
|
||||
window.log.info('Found early reaction for outgoing message');
|
||||
log.info('Found early reaction for outgoing message');
|
||||
this.remove(outgoingReactions);
|
||||
return outgoingReactions;
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ export class Reactions extends Collection {
|
|||
});
|
||||
|
||||
if (reactionsBySource.length > 0) {
|
||||
window.log.info('Found early reaction for message');
|
||||
log.info('Found early reaction for message');
|
||||
this.remove(reactionsBySource);
|
||||
return reactionsBySource;
|
||||
}
|
||||
|
@ -75,7 +76,7 @@ export class Reactions extends Collection {
|
|||
reaction.get('targetTimestamp')
|
||||
);
|
||||
if (!targetConversation) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'No target conversation for reaction',
|
||||
reaction.get('targetAuthorUuid'),
|
||||
reaction.get('targetTimestamp')
|
||||
|
@ -87,10 +88,7 @@ export class Reactions extends Collection {
|
|||
return await targetConversation.queueJob(
|
||||
'Reactions.onReaction',
|
||||
async () => {
|
||||
window.log.info(
|
||||
'Handling reaction for',
|
||||
reaction.get('targetTimestamp')
|
||||
);
|
||||
log.info('Handling reaction for', reaction.get('targetTimestamp'));
|
||||
|
||||
const messages = await window.Signal.Data.getMessagesBySentAt(
|
||||
reaction.get('targetTimestamp'),
|
||||
|
@ -115,7 +113,7 @@ export class Reactions extends Collection {
|
|||
});
|
||||
|
||||
if (!targetMessage) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'No message for reaction',
|
||||
reaction.get('targetAuthorUuid'),
|
||||
reaction.get('targetTimestamp')
|
||||
|
@ -149,7 +147,7 @@ export class Reactions extends Collection {
|
|||
}
|
||||
);
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
log.error(
|
||||
'Reactions.onReaction error:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
|
|
|
@ -8,6 +8,7 @@ import { Collection, Model } from 'backbone';
|
|||
import { MessageModel } from '../models/messages';
|
||||
import { isIncoming } from '../state/selectors/message';
|
||||
import { isMessageUnread } from '../util/isMessageUnread';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
type ReadSyncAttributesType = {
|
||||
senderId: string;
|
||||
|
@ -28,7 +29,7 @@ async function maybeItIsAReactionReadSync(sync: ReadSyncModel): Promise<void> {
|
|||
);
|
||||
|
||||
if (!readReaction) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'Nothing found for read sync',
|
||||
sync.get('senderId'),
|
||||
sync.get('sender'),
|
||||
|
@ -67,9 +68,7 @@ export class ReadSyncs extends Collection {
|
|||
);
|
||||
});
|
||||
if (sync) {
|
||||
window.log.info(
|
||||
`Found early read sync for message ${sync.get('timestamp')}`
|
||||
);
|
||||
log.info(`Found early read sync for message ${sync.get('timestamp')}`);
|
||||
this.remove(sync);
|
||||
return sync;
|
||||
}
|
||||
|
@ -145,7 +144,7 @@ export class ReadSyncs extends Collection {
|
|||
|
||||
this.remove(sync);
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
log.error(
|
||||
'ReadSyncs.onSync error:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { Collection, Model } from 'backbone';
|
||||
import { MessageModel } from '../models/messages';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
type ViewOnceOpenSyncAttributesType = {
|
||||
source?: string;
|
||||
|
@ -33,7 +34,7 @@ export class ViewOnceOpenSyncs extends Collection<ViewOnceOpenSyncModel> {
|
|||
);
|
||||
});
|
||||
if (syncBySourceUuid) {
|
||||
window.log.info('Found early view once open sync for message');
|
||||
log.info('Found early view once open sync for message');
|
||||
this.remove(syncBySourceUuid);
|
||||
return syncBySourceUuid;
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ export class ViewOnceOpenSyncs extends Collection<ViewOnceOpenSyncModel> {
|
|||
);
|
||||
});
|
||||
if (syncBySource) {
|
||||
window.log.info('Found early view once open sync for message');
|
||||
log.info('Found early view once open sync for message');
|
||||
this.remove(syncBySource);
|
||||
return syncBySource;
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ export class ViewOnceOpenSyncs extends Collection<ViewOnceOpenSyncModel> {
|
|||
const syncSourceUuid = sync.get('sourceUuid');
|
||||
const syncTimestamp = sync.get('timestamp');
|
||||
const wasMessageFound = Boolean(found);
|
||||
window.log.info('Receive view once open sync:', {
|
||||
log.info('Receive view once open sync:', {
|
||||
syncSource,
|
||||
syncSourceUuid,
|
||||
syncTimestamp,
|
||||
|
@ -96,7 +97,7 @@ export class ViewOnceOpenSyncs extends Collection<ViewOnceOpenSyncModel> {
|
|||
|
||||
this.remove(sync);
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
log.error(
|
||||
'ViewOnceOpenSyncs.onSync error:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
|
|
|
@ -9,6 +9,7 @@ import { MessageModel } from '../models/messages';
|
|||
import { ReadStatus } from '../messages/MessageReadStatus';
|
||||
import { markViewed } from '../services/MessageUpdater';
|
||||
import { isIncoming } from '../state/selectors/message';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
type ViewSyncAttributesType = {
|
||||
senderId: string;
|
||||
|
@ -43,7 +44,7 @@ export class ViewSyncs extends Collection {
|
|||
);
|
||||
});
|
||||
if (syncs.length) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
`Found ${syncs.length} early view sync(s) for message ${message.get(
|
||||
'sent_at'
|
||||
)}`
|
||||
|
@ -72,7 +73,7 @@ export class ViewSyncs extends Collection {
|
|||
});
|
||||
|
||||
if (!found) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'Nothing found for view sync',
|
||||
sync.get('senderId'),
|
||||
sync.get('senderE164'),
|
||||
|
@ -92,7 +93,7 @@ export class ViewSyncs extends Collection {
|
|||
|
||||
this.remove(sync);
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
log.error(
|
||||
'ViewSyncs.onSync error:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue