diff --git a/packages/state-manager/src/sagas/appConnection/uptime/uptime.saga.ts b/packages/state-manager/src/sagas/appConnection/uptime/uptime.saga.ts index 6f40c09269..92819a2362 100644 --- a/packages/state-manager/src/sagas/appConnection/uptime/uptime.saga.ts +++ b/packages/state-manager/src/sagas/appConnection/uptime/uptime.saga.ts @@ -1,13 +1,10 @@ import { delay, put } from 'typed-redux-saga' -import createLogger from '../../../utils/logger' import { connectionActions } from '../connection.slice' -const logger = createLogger('connection') - export function* uptimeSaga(): Generator { // There is no point in updating this more often as we don't need precise data here, but we want to avoid spamming redux with excess actions const interval = 10000 - logger.debug(`Updating uptime on interval ${interval}ms`) + console.info(`Updating uptime on interval ${interval}ms`) while (true) { yield* put(connectionActions.updateUptime(interval)) yield* delay(interval) diff --git a/packages/state-manager/src/sagas/communities/communities.selectors.ts b/packages/state-manager/src/sagas/communities/communities.selectors.ts index 452b3808f1..f4fcd7f999 100644 --- a/packages/state-manager/src/sagas/communities/communities.selectors.ts +++ b/packages/state-manager/src/sagas/communities/communities.selectors.ts @@ -3,9 +3,6 @@ import { createSelector } from 'reselect' import { communitiesAdapter } from './communities.adapter' import { type CreatedSelectors, type StoreState } from '../store.types' import { CertFieldsTypes, getCertFieldValue, parseCertificate } from '@quiet/identity' -import createLogger from '../../utils/logger' - -const logger = createLogger('communities') // Workaround for "The inferred type of 'communitiesSelectors' cannot be named without a reference to // 'packages/identity/node_modules/pkijs/build'. This is likely not portable. A type annotation is necessary." @@ -67,7 +64,7 @@ export const ownerNickname = createSelector(ownerCertificate, ownerCertificate = const nickname = getCertFieldValue(parsedCert, CertFieldsTypes.nickName) if (!nickname) { - logger.error('Could not retrieve owner nickname from certificate') + console.error('Could not retrieve owner nickname from certificate') } return nickname diff --git a/packages/state-manager/src/sagas/communities/launchCommunity/launchCommunity.saga.ts b/packages/state-manager/src/sagas/communities/launchCommunity/launchCommunity.saga.ts index f5c1422d35..df08376b55 100644 --- a/packages/state-manager/src/sagas/communities/launchCommunity/launchCommunity.saga.ts +++ b/packages/state-manager/src/sagas/communities/launchCommunity/launchCommunity.saga.ts @@ -11,9 +11,6 @@ import { connectionSelectors } from '../../appConnection/connection.selectors' import { networkSelectors } from '../../network/network.selectors' import { pairsToP2pAddresses } from '@quiet/common' import { type Community, type InitCommunityPayload, SocketActionTypes } from '@quiet/types' -import createLogger from '../../../utils/logger' - -const logger = createLogger('communities') export function* initCommunities(): Generator { const joinedCommunities = yield* select(identitySelectors.joinedCommunities) @@ -46,7 +43,7 @@ export function* launchCommunitySaga( const identity = yield* select(identitySelectors.selectById(communityId)) if (!community || !identity?.userCsr?.userKey) { - logger.error('Could not launch community, missing community or user private key') + console.error('Could not launch community, missing community or user private key') return } diff --git a/packages/state-manager/src/sagas/files/autoDownloadFiles/autoDownloadFiles.saga.ts b/packages/state-manager/src/sagas/files/autoDownloadFiles/autoDownloadFiles.saga.ts index 964626b8d2..084a7a8527 100644 --- a/packages/state-manager/src/sagas/files/autoDownloadFiles/autoDownloadFiles.saga.ts +++ b/packages/state-manager/src/sagas/files/autoDownloadFiles/autoDownloadFiles.saga.ts @@ -7,9 +7,6 @@ import { AUTODOWNLOAD_SIZE_LIMIT } from '../../../constants' import { filesActions } from '../files.slice' import { applyEmitParams, type Socket } from '../../../types' import { DownloadState, MessageType, SocketActionTypes } from '@quiet/types' -import createLogger from '../../../utils/logger' - -const logger = createLogger('files') export function* autoDownloadFilesSaga( socket: Socket, diff --git a/packages/state-manager/src/sagas/files/broadcastHostedFile/broadcastHostedFile.saga.ts b/packages/state-manager/src/sagas/files/broadcastHostedFile/broadcastHostedFile.saga.ts index 0ab5b3b336..97db579530 100644 --- a/packages/state-manager/src/sagas/files/broadcastHostedFile/broadcastHostedFile.saga.ts +++ b/packages/state-manager/src/sagas/files/broadcastHostedFile/broadcastHostedFile.saga.ts @@ -6,9 +6,6 @@ import { identitySelectors } from '../../identity/identity.selectors' import { messagesSelectors } from '../../messages/messages.selectors' import { type filesActions } from '../files.slice' import { instanceOfChannelMessage, SocketActionTypes } from '@quiet/types' -import createLogger from '../../../utils/logger' - -const logger = createLogger('files') export function* broadcastHostedFileSaga( socket: Socket, @@ -24,7 +21,7 @@ export function* broadcastHostedFileSaga( const message = channelMessages[action.payload.message.id] if (!message || !instanceOfChannelMessage(message)) { - logger.error( + console.error( `Cannot broadcast message after uploading. Draft ${action.payload.message.id} from #${action.payload.message.channelId} does not exist in local storage.` ) return diff --git a/packages/state-manager/src/sagas/files/updateMessageMedia/updateMessageMedia.ts b/packages/state-manager/src/sagas/files/updateMessageMedia/updateMessageMedia.ts index 54f95378b7..56c7cefac6 100644 --- a/packages/state-manager/src/sagas/files/updateMessageMedia/updateMessageMedia.ts +++ b/packages/state-manager/src/sagas/files/updateMessageMedia/updateMessageMedia.ts @@ -4,9 +4,6 @@ import { messagesSelectors } from '../../messages/messages.selectors' import { messagesActions } from '../../messages/messages.slice' import { type filesActions } from '../files.slice' import { instanceOfChannelMessage } from '@quiet/types' -import createLogger from '../../../utils/logger' - -const logger = createLogger('files') export function* updateMessageMediaSaga( action: PayloadAction['payload']> @@ -17,7 +14,7 @@ export function* updateMessageMediaSaga( const message = channelMessages[action.payload.message.id] if (!message || !instanceOfChannelMessage(message)) { - logger.error( + console.error( `Cannot update message media. Message ${action.payload.message.id} from #${action.payload.message.channelId} does not exist in local storage.` ) return diff --git a/packages/state-manager/src/sagas/files/uploadFile/sendFileMessage.saga.ts b/packages/state-manager/src/sagas/files/uploadFile/sendFileMessage.saga.ts index 77c15f3491..3ec4e1d830 100644 --- a/packages/state-manager/src/sagas/files/uploadFile/sendFileMessage.saga.ts +++ b/packages/state-manager/src/sagas/files/uploadFile/sendFileMessage.saga.ts @@ -6,9 +6,6 @@ import { messagesActions } from '../../messages/messages.slice' import { generateMessageId } from '../../messages/utils/message.utils' import { publicChannelsSelectors } from '../../publicChannels/publicChannels.selectors' import { DownloadState, type FileMetadata, imagesExtensions, MessageType } from '@quiet/types' -import createLogger from '../../../utils/logger' - -const logger = createLogger('files') export function* sendFileMessageSaga( action: PayloadAction['payload']> @@ -26,7 +23,7 @@ export function* sendFileMessageSaga( filePath = decodeURIComponent(filePath.startsWith(fileProtocol) ? filePath.slice(fileProtocol.length) : filePath) tmpPath = tmpPath ? decodeURIComponent(tmpPath.slice(fileProtocol.length)) : undefined } catch (e) { - logger.error(`Can't send file with path ${filePath}, Details: ${e.message}`) + console.error(`Can't send file with path ${filePath}, Details: ${e.message}`) return } diff --git a/packages/state-manager/src/sagas/identity/registerUsername/registerUsername.saga.ts b/packages/state-manager/src/sagas/identity/registerUsername/registerUsername.saga.ts index 5181ae3ae5..b480a4be94 100644 --- a/packages/state-manager/src/sagas/identity/registerUsername/registerUsername.saga.ts +++ b/packages/state-manager/src/sagas/identity/registerUsername/registerUsername.saga.ts @@ -8,9 +8,6 @@ import { Socket } from '../../../types' import { communitiesActions } from '../../communities/communities.slice' import { communitiesSelectors } from '../../communities/communities.selectors' import { CreateUserCsrPayload, RegisterCertificatePayload, Community } from '@quiet/types' -import createLogger from '../../../utils/logger' - -const logger = createLogger('identity') export function* registerUsernameSaga( socket: Socket, @@ -29,7 +26,7 @@ export function* registerUsernameSaga( } community = yield* select(communitiesSelectors.currentCommunity) if (!community) { - logger.error('Could not register username, no community data') + console.error('Could not register username, no community data') return } console.log('Found community', community.id) @@ -41,7 +38,7 @@ export function* registerUsernameSaga( } identity = yield* select(identitySelectors.currentIdentity) if (!identity) { - logger.error('Could not register username, no identity') + console.error('Could not register username, no identity') return } console.log('Found identity', identity.id) @@ -51,7 +48,7 @@ export function* registerUsernameSaga( if (userCsr) { try { if (identity.userCsr?.userCsr == null || identity.userCsr.userKey == null) { - logger.error('identity.userCsr?.userCsr == null || identity.userCsr.userKey == null') + console.error('identity.userCsr?.userCsr == null || identity.userCsr.userKey == null') return } const _pubKey = yield* call(pubKeyFromCsr, identity.userCsr.userCsr) @@ -72,7 +69,7 @@ export function* registerUsernameSaga( console.log('Recreating user CSR') userCsr = yield* call(createUserCsr, payload) } catch (e) { - logger.error('Error occurred while creating new CSR from existing', e) + console.error('Error occurred while creating new CSR from existing', e) return } } else { @@ -88,7 +85,7 @@ export function* registerUsernameSaga( console.log('Creating user CSR') userCsr = yield* call(createUserCsr, payload) } catch (e) { - logger.error('Error occurred while generating new user CSR', e) + console.error('Error occurred while generating new user CSR', e) return } } diff --git a/packages/state-manager/src/sagas/identity/saveUserCsr/saveUserCsr.saga.ts b/packages/state-manager/src/sagas/identity/saveUserCsr/saveUserCsr.saga.ts index f78ccbb1ec..0cc07fd1c7 100644 --- a/packages/state-manager/src/sagas/identity/saveUserCsr/saveUserCsr.saga.ts +++ b/packages/state-manager/src/sagas/identity/saveUserCsr/saveUserCsr.saga.ts @@ -2,9 +2,6 @@ import { SaveCSRPayload, SocketActionTypes } from '@quiet/types' import { applyEmitParams, type Socket } from '../../../types' import { apply, select } from 'typed-redux-saga' import { identitySelectors } from '../identity.selectors' -import createLogger from '../../../utils/logger' - -const logger = createLogger('identity') export function* saveUserCsrSaga(socket: Socket): Generator { console.log('Saving user CSR') diff --git a/packages/state-manager/src/sagas/messages/sendMessage/sendMessage.saga.ts b/packages/state-manager/src/sagas/messages/sendMessage/sendMessage.saga.ts index a9315d48fd..21e7fbccd0 100644 --- a/packages/state-manager/src/sagas/messages/sendMessage/sendMessage.saga.ts +++ b/packages/state-manager/src/sagas/messages/sendMessage/sendMessage.saga.ts @@ -10,9 +10,6 @@ import { publicChannelsSelectors } from '../../publicChannels/publicChannels.sel import { messagesActions } from '../messages.slice' import { generateMessageId, getCurrentTime } from '../utils/message.utils' import { type ChannelMessage, MessageType, SendingStatus, SocketActionTypes } from '@quiet/types' -import createLogger from '../../../utils/logger' - -const logger = createLogger('messages') export function* sendMessageSaga( socket: Socket, diff --git a/packages/state-manager/src/sagas/messages/verifyMessage/verifyMessages.saga.ts b/packages/state-manager/src/sagas/messages/verifyMessage/verifyMessages.saga.ts index cb75266f5e..f21f11c00f 100644 --- a/packages/state-manager/src/sagas/messages/verifyMessage/verifyMessages.saga.ts +++ b/packages/state-manager/src/sagas/messages/verifyMessage/verifyMessages.saga.ts @@ -6,9 +6,6 @@ import { publicChannelsSelectors } from '../../publicChannels/publicChannels.sel import { usersSelectors } from '../../users/users.selectors' import { verifyUserInfoMessage } from '@quiet/common' -import createLogger from '../../../utils/logger' - -const logger = createLogger('messages') export function* verifyMessagesSaga( action: PayloadAction>['payload'] @@ -44,7 +41,7 @@ export function* verifyMessagesSaga( const expectedMessage = yield* call(verifyUserInfoMessage, user.username, channel) if (message.message !== expectedMessage) { - logger.error(`${user.username} tried to send a malicious info message`) + console.error(`${user.username} tried to send a malicious info message`) isVerified = false } } diff --git a/packages/state-manager/src/sagas/publicChannels/channelDeletionResponse/channelDeletionResponse.saga.ts b/packages/state-manager/src/sagas/publicChannels/channelDeletionResponse/channelDeletionResponse.saga.ts index f7eed33d47..b4a5386fcc 100644 --- a/packages/state-manager/src/sagas/publicChannels/channelDeletionResponse/channelDeletionResponse.saga.ts +++ b/packages/state-manager/src/sagas/publicChannels/channelDeletionResponse/channelDeletionResponse.saga.ts @@ -1,18 +1,15 @@ import { publicChannelsActions } from '../publicChannels.slice' import { type PayloadAction } from '@reduxjs/toolkit' -import createLogger from '../../../utils/logger' import { put, delay, select } from 'typed-redux-saga' import { messagesActions } from '../../messages/messages.slice' import { communitiesSelectors } from '../../communities/communities.selectors' import { publicChannelsSelectors } from '../publicChannels.selectors' import { type PublicChannelStorage } from '@quiet/types' -const logger = createLogger('publicChannels') - export function* channelDeletionResponseSaga( action: PayloadAction['payload']> ): Generator { - logger(`Deleted channel ${action.payload.channelId} saga`) + console.log(`Deleted channel ${action.payload.channelId} saga`) const { channelId } = action.payload const generalChannel = yield* select(publicChannelsSelectors.generalChannel) @@ -20,12 +17,12 @@ export function* channelDeletionResponseSaga( const isChannelExist = yield* select(publicChannelsSelectors.getChannelById(channelId)) const currentChannelId = yield* select(publicChannelsSelectors.currentChannelId) if (!isChannelExist) { - logger(`Channel with id ${channelId} doesnt exist in store`) + console.error(`Channel with id ${channelId} doesnt exist in store`) return } if (!generalChannel) { - logger('General Channel doesnt exist in store') + console.error('General Channel doesnt exist in store') return } @@ -59,7 +56,7 @@ export function* channelDeletionResponseSaga( if (isGeneral && isUserOnGeneral) { let newGeneralChannel: PublicChannelStorage | undefined = yield* select(publicChannelsSelectors.generalChannel) while (!newGeneralChannel) { - logger('General channel has not been replicated yet') + console.log('General channel has not been replicated yet') yield* delay(1000) newGeneralChannel = yield* select(publicChannelsSelectors.generalChannel) } diff --git a/packages/state-manager/src/sagas/publicChannels/channelsReplicated/channelsReplicated.saga.ts b/packages/state-manager/src/sagas/publicChannels/channelsReplicated/channelsReplicated.saga.ts index 1de1603eed..d1544959fe 100644 --- a/packages/state-manager/src/sagas/publicChannels/channelsReplicated/channelsReplicated.saga.ts +++ b/packages/state-manager/src/sagas/publicChannels/channelsReplicated/channelsReplicated.saga.ts @@ -6,15 +6,15 @@ import { messagesSelectors } from '../../messages/messages.selectors' import { messagesActions } from '../../messages/messages.slice' import { communitiesSelectors } from '../../communities/communities.selectors' -import createLogger from '../../../utils/logger' +import logger from '../../../utils/logger' import { type PublicChannel } from '@quiet/types' -const logger = createLogger('channels') +const log = logger('channels') export function* channelsReplicatedSaga( action: PayloadAction['payload']> ): Generator { // TODO: Refactor to use QuietLogger - logger(`Syncing channels: ${JSON.stringify(action.payload, null, 2)}`) + log(`Syncing channels: ${JSON.stringify(action.payload, null, 2)}`) const { channels } = action.payload const _locallyStoredChannels = yield* select(publicChannelsSelectors.publicChannels) const locallyStoredChannels = _locallyStoredChannels.map(channel => channel.id) @@ -23,13 +23,13 @@ export function* channelsReplicatedSaga( const databaseStoredChannels = Object.values(channels) as PublicChannel[] const databaseStoredChannelsIds = databaseStoredChannels.map(channel => channel.id) - logger({ locallyStoredChannels, databaseStoredChannelsIds }) + log({ locallyStoredChannels, databaseStoredChannelsIds }) // Upserting channels to local storage for (const channel of databaseStoredChannels) { if (!locallyStoredChannels.includes(channel.id)) { // TODO: Refactor to use QuietLogger - logger(`Adding #${channel.name} to store`) + log(`Adding #${channel.name} to store`) yield* putResolve( publicChannelsActions.addChannel({ channel, @@ -48,7 +48,7 @@ export function* channelsReplicatedSaga( for (const channelId of locallyStoredChannels) { if (!databaseStoredChannelsIds.includes(channelId)) { // TODO: Refactor to use QuietLogger - logger(`Removing #${channelId} from store`) + log(`Removing #${channelId} from store`) yield* putResolve(publicChannelsActions.deleteChannel({ channelId })) yield* take(publicChannelsActions.completeChannelDeletion) } diff --git a/packages/state-manager/src/sagas/publicChannels/createChannel/createChannel.saga.ts b/packages/state-manager/src/sagas/publicChannels/createChannel/createChannel.saga.ts index 86330c80e4..eac5acb883 100644 --- a/packages/state-manager/src/sagas/publicChannels/createChannel/createChannel.saga.ts +++ b/packages/state-manager/src/sagas/publicChannels/createChannel/createChannel.saga.ts @@ -4,17 +4,13 @@ import { type PayloadAction } from '@reduxjs/toolkit' import { apply, put } from 'typed-redux-saga' import { type Socket, applyEmitParams } from '../../../types' -import createLogger from '../../../utils/logger' - import { SocketActionTypes, type CreateChannelResponse } from '@quiet/types' -const logger = createLogger('publicChannels') - export function* createChannelSaga( socket: Socket, action: PayloadAction['payload']> ): Generator { - logger.info(`Creating channel ${action.payload.channel.name}`) + console.info(`Creating channel ${action.payload.channel.name}`) const response = yield* apply( socket, diff --git a/packages/state-manager/src/sagas/publicChannels/createGeneralChannel/createGeneralChannel.saga.ts b/packages/state-manager/src/sagas/publicChannels/createGeneralChannel/createGeneralChannel.saga.ts index 8405136959..901dbbedf2 100644 --- a/packages/state-manager/src/sagas/publicChannels/createGeneralChannel/createGeneralChannel.saga.ts +++ b/packages/state-manager/src/sagas/publicChannels/createGeneralChannel/createGeneralChannel.saga.ts @@ -2,19 +2,16 @@ import { select, put, call } from 'typed-redux-saga' import { publicChannelsActions } from '../publicChannels.slice' import { identitySelectors } from '../../identity/identity.selectors' import { DateTime } from 'luxon' -import createLogger from '../../../utils/logger' import { generateChannelId } from '@quiet/common' import { type PublicChannel } from '@quiet/types' -const logger = createLogger('publicChannels') - export function* createGeneralChannelSaga(): Generator { const identity = yield* select(identitySelectors.currentIdentity) if (!identity) { - logger.error('Could not create general channel. No identity') + console.error('Could not create general channel. No identity') return } - logger.info(`Creating general channel for ${identity.nickname}`) + console.info(`Creating general channel for ${identity.nickname}`) const timestamp = yield* call(getChannelTimestamp) const id = yield* call(generateChannelId, 'general') diff --git a/packages/state-manager/src/sagas/publicChannels/deleteChannel/deleteChannel.saga.ts b/packages/state-manager/src/sagas/publicChannels/deleteChannel/deleteChannel.saga.ts index a47cd1ebcf..d69c6cf228 100644 --- a/packages/state-manager/src/sagas/publicChannels/deleteChannel/deleteChannel.saga.ts +++ b/packages/state-manager/src/sagas/publicChannels/deleteChannel/deleteChannel.saga.ts @@ -2,14 +2,11 @@ import { type PayloadAction } from '@reduxjs/toolkit' import { publicChannelsActions } from '../publicChannels.slice' import { apply, put, select } from 'typed-redux-saga' import { type Socket, applyEmitParams } from '../../../types' -import createLogger from '../../../utils/logger' import { filesActions } from '../../files/files.slice' import { SocketActionTypes } from '@quiet/types' import { publicChannelsSelectors } from '../publicChannels.selectors' import { usersSelectors } from '../../users/users.selectors' -const logger = createLogger('publicChannels') - export function* deleteChannelSaga( socket: Socket, action: PayloadAction['payload']> @@ -25,7 +22,7 @@ export function* deleteChannelSaga( const isGeneral = channelId === generalChannel.id - logger.info(`Deleting channel ${channelId}`) + console.info(`Deleting channel ${channelId}`) const response = yield* apply( socket, diff --git a/packages/state-manager/src/sagas/publicChannels/publicChannels.selectors.ts b/packages/state-manager/src/sagas/publicChannels/publicChannels.selectors.ts index 01df70b2b3..e13fd44bb7 100644 --- a/packages/state-manager/src/sagas/publicChannels/publicChannels.selectors.ts +++ b/packages/state-manager/src/sagas/publicChannels/publicChannels.selectors.ts @@ -25,11 +25,8 @@ import { } from '@quiet/types' import { networkSelectors } from '../network/network.selectors' import { communitiesSelectors } from '../communities/communities.selectors' -import createLogger from '../../utils/logger' import { isMessageUnsent } from '../../utils/messages/messages.utils' -const logger = createLogger('publicChannels') - const selectState: CreatedSelectors[StoreKeys.PublicChannels] = (state: StoreState) => state[StoreKeys.PublicChannels] export const selectChannels = createSelector(selectState, state => { @@ -56,7 +53,7 @@ export const subscribedChannels = createSelector(selectChannelsSubscriptions, su export const selectGeneralChannel = createSelector(selectChannels, channels => { const draft = channels.find(item => item.name === 'general') if (!draft) { - logger.error('No general channel') + console.error('No general channel') return } const channel: PublicChannel = { @@ -130,7 +127,7 @@ export const getChannelById = (channelId: string) => createSelector(publicChannels, channels => { const channel = channels.find(channel => channel.id === channelId) if (!channel) { - logger.warn(`Channel with ID ${channelId} does not exist`) + console.warn(`Channel with ID ${channelId} does not exist`) } return channel }) diff --git a/packages/state-manager/src/sagas/publicChannels/publicChannels.slice.ts b/packages/state-manager/src/sagas/publicChannels/publicChannels.slice.ts index 9902a90c55..ad031d6dd5 100644 --- a/packages/state-manager/src/sagas/publicChannels/publicChannels.slice.ts +++ b/packages/state-manager/src/sagas/publicChannels/publicChannels.slice.ts @@ -7,7 +7,6 @@ import { publicChannelsSubscriptionsAdapter, } from './publicChannels.adapter' -import createLogger from '../../utils/logger' import { type CacheMessagesPayload, type DeleteChannelResponse, @@ -30,7 +29,6 @@ import { type SetCurrentChannelPayload, type UpdateNewestMessagePayload, } from '@quiet/types' -const logger = createLogger('publicChannels') export class PublicChannelsState { public currentChannelId: string = INITIAL_CURRENT_CHANNEL_ID diff --git a/packages/state-manager/src/sagas/publicChannels/publicChannels.transform.ts b/packages/state-manager/src/sagas/publicChannels/publicChannels.transform.ts index 5c385bddfb..05858a5d0d 100644 --- a/packages/state-manager/src/sagas/publicChannels/publicChannels.transform.ts +++ b/packages/state-manager/src/sagas/publicChannels/publicChannels.transform.ts @@ -3,9 +3,6 @@ import { createTransform } from 'redux-persist' import { StoreKeys } from '../store.keys' import { publicChannelsAdapter, publicChannelsSubscriptionsAdapter } from './publicChannels.adapter' import { type PublicChannelsState } from './publicChannels.slice' -import createLogger from '../../utils/logger' - -const logger = createLogger('publicChannels') export const PublicChannelsTransform = createTransform( (inboundState: PublicChannelsState, _key: any) => { @@ -29,8 +26,8 @@ const getGeneralChannelId = (state: PublicChannelsState) => { const selectors = publicChannelsAdapter.getSelectors() const publicChannelStorage = selectors.selectAll(state.channels) const generalChannel = publicChannelStorage.find(channel => channel.name === 'general') - logger.info('PublicChannelsTransform: existing general channel id', generalChannel?.id) + console.info('PublicChannelsTransform: existing general channel id', generalChannel?.id) const generalChannelId = generalChannel?.id || INITIAL_CURRENT_CHANNEL_ID - logger.info('PublicChannelsTransform: new general channel id', generalChannelId) + console.info('PublicChannelsTransform: new general channel id', generalChannelId) return generalChannelId } diff --git a/packages/state-manager/src/sagas/users/userProfile/saveUserProfile.saga.ts b/packages/state-manager/src/sagas/users/userProfile/saveUserProfile.saga.ts index 5d6bdc5205..98734e9a1d 100644 --- a/packages/state-manager/src/sagas/users/userProfile/saveUserProfile.saga.ts +++ b/packages/state-manager/src/sagas/users/userProfile/saveUserProfile.saga.ts @@ -11,12 +11,9 @@ import { fileToBase64String } from '@quiet/common' import { config } from '../../users/const/certFieldTypes' import { identitySelectors } from '../../identity/identity.selectors' -import createLogger from '../../../utils/logger' import { usersActions } from '../users.slice' import { type Socket, applyEmitParams } from '../../../types' -const logger = createLogger('saveUserProfileSaga') - export function* saveUserProfileSaga(socket: Socket, action: PayloadAction<{ photo?: File }>): Generator { const identity = yield* select(identitySelectors.currentIdentity) @@ -28,7 +25,7 @@ export function* saveUserProfileSaga(socket: Socket, action: PayloadAction<{ pho try { base64EncodedPhoto = yield* call(fileToBase64String, action.payload.photo) } catch (err) { - logger.error('Failed to base64 encode profile photo', err) + console.error('Failed to base64 encode profile photo', err) return } @@ -47,7 +44,7 @@ export function* saveUserProfileSaga(socket: Socket, action: PayloadAction<{ pho pubKey, } - logger.info(`Saving user profile: ${userProfile}`) + console.info(`Saving user profile: ${userProfile}`) yield* apply(socket, socket.emit, applyEmitParams(SocketActionTypes.SET_USER_PROFILE, userProfile)) } diff --git a/packages/state-manager/src/sagas/users/users.selectors.ts b/packages/state-manager/src/sagas/users/users.selectors.ts index 6727668bd7..4902482597 100644 --- a/packages/state-manager/src/sagas/users/users.selectors.ts +++ b/packages/state-manager/src/sagas/users/users.selectors.ts @@ -7,9 +7,6 @@ import { type Certificate } from 'pkijs' import { type CreatedSelectors, type StoreState } from '../store.types' import { type UserData, User } from '@quiet/types' import { ownerCertificate } from '../communities/communities.selectors' -import createLogger from '../../utils/logger' - -const logger = createLogger('users') const usersSlice: CreatedSelectors[StoreKeys.Users] = (state: StoreState) => state[StoreKeys.Users] @@ -34,7 +31,7 @@ export const certificatesMapping = createSelector(certificates, certs => { const peerId = getCertFieldValue(certificate, CertFieldsTypes.peerId) if (!username || !onionAddress || !peerId) { - logger.error(`Could not parse certificate for pubkey ${pubKey}`) + console.error(`Could not parse certificate for pubkey ${pubKey}`) return } @@ -61,7 +58,7 @@ export const csrsMapping = createSelector(csrs, csrs => { const peerId = getReqFieldValue(csr, CertFieldsTypes.peerId) if (!username || !onionAddress || !peerId) { - logger.error(`Could not parse certificate for pubkey ${pubKey}`) + console.error(`Could not parse certificate for pubkey ${pubKey}`) return } diff --git a/packages/state-manager/src/utils/tests/helpers.ts b/packages/state-manager/src/utils/tests/helpers.ts index 689c083ee5..4ffbb0f33e 100644 --- a/packages/state-manager/src/utils/tests/helpers.ts +++ b/packages/state-manager/src/utils/tests/helpers.ts @@ -1,11 +1,9 @@ import { keyFromCertificate, loadPrivateKey, parseCertificate, sign } from '@quiet/identity' -import createLogger from '../logger' // import fs from 'fs' // import os from 'os' import { arrayBufferToString } from 'pvutils' import { config } from '../../sagas/users/const/certFieldTypes' import { type PeerId } from '@quiet/types' -const logger = createLogger('test') const notBeforeDate = new Date(Date.UTC(2010, 11, 28, 10, 10, 10)) const notAfterDate = new Date(Date.UTC(2030, 11, 28, 10, 10, 10))