Import log instead of using it off of window

This commit is contained in:
Josh Perez 2021-09-17 14:27:53 -04:00 committed by GitHub
parent 8eb0dd3116
commit 65ddf0a9e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
155 changed files with 3654 additions and 3433 deletions

View file

@ -51,6 +51,7 @@ import {
getCallSelector,
} from './calling';
import { getAccountSelector, AccountSelectorType } from './accounts';
import * as log from '../../logging/log';
let placeholderContact: ConversationType;
export const getPlaceholderContact = (): ConversationType => {
@ -635,9 +636,7 @@ export const getConversationSelector = createSelector(
): GetConversationByIdType => {
return (id?: string) => {
if (!id) {
window.log.warn(
`getConversationSelector: Called with a falsey id ${id}`
);
log.warn(`getConversationSelector: Called with a falsey id ${id}`);
// This will return a placeholder contact
return selector(undefined);
}
@ -659,9 +658,7 @@ export const getConversationSelector = createSelector(
return selector(onId);
}
window.log.warn(
`getConversationSelector: No conversation found for id ${id}`
);
log.warn(`getConversationSelector: No conversation found for id ${id}`);
// This will return a placeholder contact
return selector(undefined);
};
@ -743,7 +740,7 @@ export const getContactNameColorSelector = createSelector(
);
const color = contactNameColors.get(contactId);
if (!color) {
window.log.warn(`No color generated for contact ${contactId}`);
log.warn(`No color generated for contact ${contactId}`);
return ContactNameColors[0];
}
return color;

View file

@ -75,6 +75,7 @@ import {
maxStatus,
someSendStatus,
} from '../../messages/MessageSendState';
import * as log from '../../logging/log';
const THREE_HOURS = 3 * 60 * 60 * 1000;
@ -135,9 +136,7 @@ export function getSource(
return message.source;
}
if (!isOutgoing(message)) {
window.log.warn(
'message.getSource: Called for non-incoming/non-outoing message'
);
log.warn('message.getSource: Called for non-incoming/non-outoing message');
}
return ourNumber;
@ -153,7 +152,7 @@ export function getSourceDevice(
return sourceDevice;
}
if (!isOutgoing(message)) {
window.log.warn(
log.warn(
'message.getSourceDevice: Called for non-incoming/non-outoing message'
);
}
@ -169,7 +168,7 @@ export function getSourceUuid(
return message.sourceUuid;
}
if (!isOutgoing(message)) {
window.log.warn(
log.warn(
'message.getSourceUuid: Called for non-incoming/non-outoing message'
);
}
@ -1079,7 +1078,7 @@ export function getPropsForCallHistory(
const creator = conversationSelector(callHistoryDetails.creatorUuid);
let call = callSelector(conversationId);
if (call && call.callMode !== CallMode.Group) {
window.log.error(
log.error(
'getPropsForCallHistory: there is an unexpected non-group call; pretending it does not exist'
);
call = undefined;

View file

@ -29,6 +29,7 @@ import {
} from './conversations';
import { BodyRangeType } from '../../types/Util';
import * as log from '../../logging/log';
export const getSearch = (state: StateType): SearchStateType => state.search;
@ -187,7 +188,7 @@ export const getMessageSearchResultSelector = createSelector(
return (id: string) => {
const message = messageSearchResultLookup[id];
if (!message) {
window.log.warn(
log.warn(
`getMessageSearchResultSelector: messageSearchResultLookup was missing id ${id}`
);
return undefined;
@ -207,9 +208,7 @@ export const getMessageSearchResultSelector = createSelector(
from = conversationSelector(ourConversationId);
to = conversationSelector(conversationId);
} else {
window.log.warn(
`getMessageSearchResultSelector: Got unexpected type ${type}`
);
log.warn(`getMessageSearchResultSelector: Got unexpected type ${type}`);
return undefined;
}