better logs
This commit is contained in:
parent
6f03e77bf7
commit
980a69da48
|
@ -1,5 +1,5 @@
|
||||||
import # system libs
|
import # system libs
|
||||||
tables
|
tables, chronicles
|
||||||
|
|
||||||
import # deps
|
import # deps
|
||||||
uuids
|
uuids
|
||||||
|
@ -46,7 +46,8 @@ proc disconnect*(this: EventEmitter, handlerId: UUID) =
|
||||||
this.events[k].del handlerId
|
this.events[k].del handlerId
|
||||||
|
|
||||||
proc emit*(this:EventEmitter, name:string, args:Args): void =
|
proc emit*(this:EventEmitter, name:string, args:Args): void =
|
||||||
echo "Emitting ", name
|
if name != "signal:chronicles-log":
|
||||||
|
debug "Emitting event", name
|
||||||
if this.events.hasKey(name):
|
if this.events.hasKey(name):
|
||||||
# collect the handlers before executing them
|
# collect the handlers before executing them
|
||||||
# because of 'once' proc, we also mutate
|
# because of 'once' proc, we also mutate
|
||||||
|
|
|
@ -34,8 +34,6 @@ QtObject:
|
||||||
error "Invalid signal received", data = statusSignal
|
error "Invalid signal received", data = statusSignal
|
||||||
return
|
return
|
||||||
|
|
||||||
trace "Raw signal data", data = $jsonSignal
|
|
||||||
|
|
||||||
var signal:Signal
|
var signal:Signal
|
||||||
try:
|
try:
|
||||||
signal = self.decode(jsonSignal)
|
signal = self.decode(jsonSignal)
|
||||||
|
@ -56,7 +54,6 @@ QtObject:
|
||||||
self.processSignal(signal)
|
self.processSignal(signal)
|
||||||
|
|
||||||
proc decode(self: SignalsManager, jsonSignal: JsonNode): Signal =
|
proc decode(self: SignalsManager, jsonSignal: JsonNode): Signal =
|
||||||
echo jsonSignal
|
|
||||||
let signalString = jsonSignal{"type"}.getStr
|
let signalString = jsonSignal{"type"}.getStr
|
||||||
var signalType: SignalType
|
var signalType: SignalType
|
||||||
try:
|
try:
|
||||||
|
@ -64,6 +61,8 @@ QtObject:
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
raise newException(ValueError, "Unknown signal received: " & signalString)
|
raise newException(ValueError, "Unknown signal received: " & signalString)
|
||||||
|
|
||||||
|
if signalType != SignalType.ChroniclesLogs:
|
||||||
|
debug "Status-go Signal", signal=jsonSignal
|
||||||
result = case signalType:
|
result = case signalType:
|
||||||
of SignalType.Message: MessageSignal.fromEvent(jsonSignal)
|
of SignalType.Message: MessageSignal.fromEvent(jsonSignal)
|
||||||
of SignalType.MessageDelivered: MessageDeliveredSignal.fromEvent(jsonSignal)
|
of SignalType.MessageDelivered: MessageDeliveredSignal.fromEvent(jsonSignal)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Tables, stint
|
import Tables, stint, chronicles
|
||||||
import ./io_interface
|
import ./io_interface
|
||||||
|
|
||||||
import ../../../global/app_signals
|
import ../../../global/app_signals
|
||||||
|
@ -99,7 +99,7 @@ proc getContactDetails*(self: Controller, contactId: string): ContactDetails =
|
||||||
return self.contactsService.getContactDetails(contactId)
|
return self.contactsService.getContactDetails(contactId)
|
||||||
|
|
||||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
echo "getCommunityById from activity_center module"
|
debug "getCommunityById from activity_center module", communityId
|
||||||
return self.communityService.getCommunityById(communityId)
|
return self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getActivityCenterNotifications*(self: Controller): seq[ActivityCenterNotificationDto] =
|
proc getActivityCenterNotifications*(self: Controller): seq[ActivityCenterNotificationDto] =
|
||||||
|
|
|
@ -89,7 +89,7 @@ proc getChannelGroups*(self: Controller): seq[ChannelGroupDto] =
|
||||||
return self.chatService.getChannelGroups()
|
return self.chatService.getChannelGroups()
|
||||||
|
|
||||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
echo "getCommunityById from app_search module"
|
debug "getCommunityById from app_search module", communityId
|
||||||
return self.communityService.getCommunityById(communityId)
|
return self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getChatDetailsForChatTypes*(self: Controller, types: seq[ChatType]): seq[ChatDto] =
|
proc getChatDetailsForChatTypes*(self: Controller, types: seq[ChatType]): seq[ChatDto] =
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import NimQml
|
import NimQml, chronicles
|
||||||
import json
|
import json
|
||||||
import io_interface
|
import io_interface
|
||||||
|
|
||||||
|
@ -179,9 +179,9 @@ proc init*(self: Controller) =
|
||||||
var args = ChatUpdateArgs(e)
|
var args = ChatUpdateArgs(e)
|
||||||
for chat in args.chats:
|
for chat in args.chats:
|
||||||
if self.chatId == chat.id:
|
if self.chatId == chat.id:
|
||||||
echo "Chat content"
|
debug "Chat content", chatId=chat.id
|
||||||
self.delegate.onChatEdited(chat)
|
self.delegate.onChatEdited(chat)
|
||||||
echo "Chat done"
|
debug "Chat done", chatId=chat.id
|
||||||
|
|
||||||
proc getMyChatId*(self: Controller): string =
|
proc getMyChatId*(self: Controller): string =
|
||||||
return self.chatId
|
return self.chatId
|
||||||
|
@ -190,7 +190,7 @@ proc getChatDetails*(self: Controller): ChatDto =
|
||||||
return self.chatService.getChatById(self.chatId)
|
return self.chatService.getChatById(self.chatId)
|
||||||
|
|
||||||
proc getCommunityDetails*(self: Controller): CommunityDto =
|
proc getCommunityDetails*(self: Controller): CommunityDto =
|
||||||
echo "getCommunityById from chat_content module"
|
debug "getCommunityById from chat_content module", communityId=self.sectionId
|
||||||
return self.communityService.getCommunityById(self.sectionId)
|
return self.communityService.getCommunityById(self.sectionId)
|
||||||
|
|
||||||
proc getOneToOneChatNameAndImage*(self: Controller): tuple[name: string, image: string, largeImage: string] =
|
proc getOneToOneChatNameAndImage*(self: Controller): tuple[name: string, image: string, largeImage: string] =
|
||||||
|
|
|
@ -240,7 +240,7 @@ proc getChatDetails*(self: Controller): ChatDto =
|
||||||
return self.chatService.getChatById(self.chatId)
|
return self.chatService.getChatById(self.chatId)
|
||||||
|
|
||||||
proc getCommunityDetails*(self: Controller): CommunityDto =
|
proc getCommunityDetails*(self: Controller): CommunityDto =
|
||||||
echo "getCommunityById from messages module"
|
debug "getCommunityById from messages module", communityId=self.sectionId
|
||||||
return self.communityService.getCommunityById(self.sectionId)
|
return self.communityService.getCommunityById(self.sectionId)
|
||||||
|
|
||||||
proc getOneToOneChatNameAndImage*(self: Controller):
|
proc getOneToOneChatNameAndImage*(self: Controller):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Tables, sugar, sequtils, strutils
|
import Tables, sugar, sequtils, strutils, chronicles
|
||||||
|
|
||||||
import io_interface
|
import io_interface
|
||||||
|
|
||||||
|
@ -156,11 +156,11 @@ proc init*(self: Controller) =
|
||||||
var args = ChatUpdateArgs(e)
|
var args = ChatUpdateArgs(e)
|
||||||
for chat in args.chats:
|
for chat in args.chats:
|
||||||
let belongsToCommunity = chat.communityId.len > 0
|
let belongsToCommunity = chat.communityId.len > 0
|
||||||
echo "Chat section"
|
debug "Chat section", id=chat.id
|
||||||
discard self.delegate.addOrUpdateChat(chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService,
|
discard self.delegate.addOrUpdateChat(chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService,
|
||||||
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
|
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
|
||||||
self.mailserversService, setChatAsActive = false)
|
self.mailserversService, setChatAsActive = false)
|
||||||
echo "Chat section done"
|
debug "Chat section done", id=chat.id
|
||||||
|
|
||||||
self.events.on(SIGNAL_CHAT_CREATED) do(e: Args):
|
self.events.on(SIGNAL_CHAT_CREATED) do(e: Args):
|
||||||
var args = CreatedChatArgs(e)
|
var args = CreatedChatArgs(e)
|
||||||
|
@ -383,7 +383,7 @@ proc isCommunity*(self: Controller): bool =
|
||||||
return self.isCommunitySection
|
return self.isCommunitySection
|
||||||
|
|
||||||
proc getMyCommunity*(self: Controller): CommunityDto =
|
proc getMyCommunity*(self: Controller): CommunityDto =
|
||||||
echo "getCommunityById from chat_section module"
|
debug "getCommunityById from chat_section module", communityId=self.sectionId
|
||||||
return self.communityService.getCommunityById(self.sectionId)
|
return self.communityService.getCommunityById(self.sectionId)
|
||||||
|
|
||||||
proc getCategories*(self: Controller, communityId: string): seq[Category] =
|
proc getCategories*(self: Controller, communityId: string): seq[Category] =
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import stint, std/strutils
|
import stint, std/strutils, chronicles
|
||||||
import ./io_interface
|
import ./io_interface
|
||||||
|
|
||||||
import ../../../core/signals/types
|
import ../../../core/signals/types
|
||||||
|
@ -205,7 +205,7 @@ proc getAllCommunities*(self: Controller): seq[CommunityDto] =
|
||||||
result = self.communityService.getAllCommunities()
|
result = self.communityService.getAllCommunities()
|
||||||
|
|
||||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
echo "getCommunityById from communities module"
|
debug "getCommunityById from communities module", communityId=communityId
|
||||||
result = self.communityService.getCommunityById(communityId)
|
result = self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getCuratedCommunities*(self: Controller): seq[CommunityDto] =
|
proc getCuratedCommunities*(self: Controller): seq[CommunityDto] =
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import NimQml, Tables
|
import NimQml, Tables, chronicles
|
||||||
import curated_community_item
|
import curated_community_item
|
||||||
import ../../../shared_models/[token_permissions_model, token_permission_item]
|
import ../../../shared_models/[token_permissions_model, token_permission_item]
|
||||||
|
|
||||||
|
@ -162,6 +162,6 @@ QtObject:
|
||||||
proc setPermissionItems*(self: CuratedCommunityModel, itemId: string, items: seq[TokenPermissionItem]) =
|
proc setPermissionItems*(self: CuratedCommunityModel, itemId: string, items: seq[TokenPermissionItem]) =
|
||||||
let idx = self.findIndexById(itemId)
|
let idx = self.findIndexById(itemId)
|
||||||
if idx == -1:
|
if idx == -1:
|
||||||
echo "Tried to set permission items on an item that doesn't exist. Item ID: ", itemId
|
debug "Tried to set permission items on an item that doesn't exist. Item ID: ", itemId
|
||||||
return
|
return
|
||||||
self.items[idx].setPermissionModelItems(items)
|
self.items[idx].setPermissionModelItems(items)
|
|
@ -1,4 +1,4 @@
|
||||||
import stint
|
import stint, chronicles
|
||||||
import ./io_interface as community_tokens_module_interface
|
import ./io_interface as community_tokens_module_interface
|
||||||
|
|
||||||
import ../../../../../app_service/service/community_tokens/service as community_tokens_service
|
import ../../../../../app_service/service/community_tokens/service as community_tokens_service
|
||||||
|
@ -138,5 +138,5 @@ proc getTokenMasterToken*(self: Controller, communityId: string): CommunityToken
|
||||||
return self.communityTokensService.getTokenMasterToken(communityId)
|
return self.communityTokensService.getTokenMasterToken(communityId)
|
||||||
|
|
||||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
echo "getCommunityById from tokens module"
|
debug "getCommunityById from tokens module", communityId
|
||||||
return self.communityService.getCommunityById(communityId)
|
return self.communityService.getCommunityById(communityId)
|
|
@ -1,4 +1,4 @@
|
||||||
import NimQml, json, strutils, sequtils
|
import NimQml, json, strutils, sequtils, chronicles
|
||||||
|
|
||||||
import ./io_interface
|
import ./io_interface
|
||||||
import ../../shared_models/[section_model, section_item, section_details, token_list_model, token_list_item,
|
import ../../shared_models/[section_model, section_item, section_details, token_list_model, token_list_item,
|
||||||
|
@ -319,7 +319,7 @@ QtObject:
|
||||||
let sharedAddresses = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
let sharedAddresses = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||||
self.delegate.checkPermissions(communityId, sharedAddresses)
|
self.delegate.checkPermissions(communityId, sharedAddresses)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
echo "Error updating token model with addresses: ", e.msg
|
debug "Error updating token model with addresses: ", msg=e.msg
|
||||||
|
|
||||||
proc getSpectatedCommunityPermissionModel(self: View): QVariant {.slot.} =
|
proc getSpectatedCommunityPermissionModel(self: View): QVariant {.slot.} =
|
||||||
return self.spectatedCommunityPermissionModelVariant
|
return self.spectatedCommunityPermissionModelVariant
|
||||||
|
@ -658,14 +658,14 @@ QtObject:
|
||||||
let addressesArray = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
let addressesArray = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||||
self.delegate.requestToJoinCommunityWithAuthentication(communityId, ensName, addressesArray, airdropAddress)
|
self.delegate.requestToJoinCommunityWithAuthentication(communityId, ensName, addressesArray, airdropAddress)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
echo "Error requesting to join community with authentication and shared addresses: ", e.msg
|
debug "Error requesting to join community with authentication and shared addresses: ", msg=e.msg
|
||||||
|
|
||||||
proc editSharedAddressesWithAuthentication*(self: View, communityId: string, addressesToShare: string, airdropAddress: string) {.slot.} =
|
proc editSharedAddressesWithAuthentication*(self: View, communityId: string, addressesToShare: string, airdropAddress: string) {.slot.} =
|
||||||
try:
|
try:
|
||||||
let addressesArray = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
let addressesArray = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||||
self.delegate.editSharedAddressesWithAuthentication(communityId, addressesArray, airdropAddress)
|
self.delegate.editSharedAddressesWithAuthentication(communityId, addressesArray, airdropAddress)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
echo "Error editing shared addresses with authentication: ", e.msg
|
debug "Error editing shared addresses with authentication: ", msg=e.msg
|
||||||
|
|
||||||
proc getCommunityPublicKeyFromPrivateKey*(self: View, communityPrivateKey: string): string {.slot.} =
|
proc getCommunityPublicKeyFromPrivateKey*(self: View, communityPrivateKey: string): string {.slot.} =
|
||||||
result = self.delegate.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
|
result = self.delegate.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import chronicles, stint, tables
|
import chronicles, stint, tables, chronicles
|
||||||
import ../../global/app_sections_config as conf
|
import ../../global/app_sections_config as conf
|
||||||
import ../../global/global_singleton
|
import ../../global/global_singleton
|
||||||
import ../../global/app_signals
|
import ../../global/app_signals
|
||||||
|
@ -501,7 +501,7 @@ proc switchTo*(self: Controller, sectionId, chatId, messageId: string) =
|
||||||
self.events.emit(SIGNAL_MAKE_SECTION_CHAT_ACTIVE, data)
|
self.events.emit(SIGNAL_MAKE_SECTION_CHAT_ACTIVE, data)
|
||||||
|
|
||||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
echo "getCommunityById from main module"
|
debug "getCommunityById from main module", communityId
|
||||||
return self.communityService.getCommunityById(communityId)
|
return self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto =
|
proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto =
|
||||||
|
|
|
@ -80,9 +80,9 @@ proc init*(self: Controller) =
|
||||||
self.events.on(SIGNAL_CHAT_UPDATE) do(e: Args):
|
self.events.on(SIGNAL_CHAT_UPDATE) do(e: Args):
|
||||||
var args = ChatUpdateArgs(e)
|
var args = ChatUpdateArgs(e)
|
||||||
for chat in args.chats:
|
for chat in args.chats:
|
||||||
echo "notifications"
|
debug "notifications", chatId=chat.id
|
||||||
self.delegate.addChat(chat)
|
self.delegate.addChat(chat)
|
||||||
echo "notifications done"
|
debug "notifications done", chatId=chat.id
|
||||||
|
|
||||||
self.events.on(SIGNAL_CHAT_RENAMED) do(e: Args):
|
self.events.on(SIGNAL_CHAT_RENAMED) do(e: Args):
|
||||||
var args = ChatRenameArgs(e)
|
var args = ChatRenameArgs(e)
|
||||||
|
|
|
@ -133,11 +133,11 @@ method addChat*(self: Module, chatDto: ChatDto) =
|
||||||
let ind = self.view.exemptionsModel().findIndexForItemId(chatDto.id)
|
let ind = self.view.exemptionsModel().findIndexForItemId(chatDto.id)
|
||||||
if(ind != -1):
|
if(ind != -1):
|
||||||
return
|
return
|
||||||
echo "Create item"
|
debug "Create item", chatId=chatDto.id
|
||||||
let item = self.createChatItem(chatDto)
|
let item = self.createChatItem(chatDto)
|
||||||
echo "created item"
|
debug "created item", chatId=chatDto.id
|
||||||
self.view.exemptionsModel().addItem(item)
|
self.view.exemptionsModel().addItem(item)
|
||||||
echo "added item"
|
debug "added item", chatId=chatDto.id
|
||||||
|
|
||||||
method addChat*(self: Module, itemId: string) =
|
method addChat*(self: Module, itemId: string) =
|
||||||
let ind = self.view.exemptionsModel().findIndexForItemId(itemId)
|
let ind = self.view.exemptionsModel().findIndexForItemId(itemId)
|
||||||
|
|
|
@ -727,7 +727,7 @@ QtObject:
|
||||||
return toSeq(self.communities.keys)
|
return toSeq(self.communities.keys)
|
||||||
|
|
||||||
proc getCommunityTokenBySymbol*(self: Service, communityId: string, symbol: string): CommunityTokenDto =
|
proc getCommunityTokenBySymbol*(self: Service, communityId: string, symbol: string): CommunityTokenDto =
|
||||||
echo "getCommunityById from getCommunityTokenBySymbol"
|
debug "getCommunityById from getCommunityTokenBySymbol"
|
||||||
let community = self.getCommunityById(communityId)
|
let community = self.getCommunityById(communityId)
|
||||||
for metadata in community.communityTokensMetadata:
|
for metadata in community.communityTokensMetadata:
|
||||||
if metadata.symbol == symbol:
|
if metadata.symbol == symbol:
|
||||||
|
@ -2003,7 +2003,7 @@ QtObject:
|
||||||
return community.declinedRequestsToJoin[indexDeclined].publicKey
|
return community.declinedRequestsToJoin[indexDeclined].publicKey
|
||||||
|
|
||||||
proc checkChatHasPermissions*(self: Service, communityId: string, chatId: string): bool =
|
proc checkChatHasPermissions*(self: Service, communityId: string, chatId: string): bool =
|
||||||
echo "getCommunityById from checkChatHasPermissions"
|
debug "getCommunityById from checkChatHasPermissions"
|
||||||
let community = self.getCommunityById(communityId)
|
let community = self.getCommunityById(communityId)
|
||||||
for id, tokenPermission in community.tokenPermissions:
|
for id, tokenPermission in community.tokenPermissions:
|
||||||
if TokenPermissionType(tokenPermission.`type`) == TokenPermissionType.View or TokenPermissionType(tokenPermission.`type`) == TokenPermissionType.ViewAndPost:
|
if TokenPermissionType(tokenPermission.`type`) == TokenPermissionType.View or TokenPermissionType(tokenPermission.`type`) == TokenPermissionType.ViewAndPost:
|
||||||
|
|
Loading…
Reference in New Issue