better logs
This commit is contained in:
parent
6f03e77bf7
commit
980a69da48
|
@ -1,5 +1,5 @@
|
|||
import # system libs
|
||||
tables
|
||||
tables, chronicles
|
||||
|
||||
import # deps
|
||||
uuids
|
||||
|
@ -46,7 +46,8 @@ proc disconnect*(this: EventEmitter, handlerId: UUID) =
|
|||
this.events[k].del handlerId
|
||||
|
||||
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):
|
||||
# collect the handlers before executing them
|
||||
# because of 'once' proc, we also mutate
|
||||
|
|
|
@ -34,8 +34,6 @@ QtObject:
|
|||
error "Invalid signal received", data = statusSignal
|
||||
return
|
||||
|
||||
trace "Raw signal data", data = $jsonSignal
|
||||
|
||||
var signal:Signal
|
||||
try:
|
||||
signal = self.decode(jsonSignal)
|
||||
|
@ -56,14 +54,15 @@ QtObject:
|
|||
self.processSignal(signal)
|
||||
|
||||
proc decode(self: SignalsManager, jsonSignal: JsonNode): Signal =
|
||||
echo jsonSignal
|
||||
let signalString = jsonSignal{"type"}.getStr
|
||||
var signalType: SignalType
|
||||
try:
|
||||
signalType = parseEnum[SignalType](signalString)
|
||||
except CatchableError:
|
||||
raise newException(ValueError, "Unknown signal received: " & signalString)
|
||||
|
||||
|
||||
if signalType != SignalType.ChroniclesLogs:
|
||||
debug "Status-go Signal", signal=jsonSignal
|
||||
result = case signalType:
|
||||
of SignalType.Message: MessageSignal.fromEvent(jsonSignal)
|
||||
of SignalType.MessageDelivered: MessageDeliveredSignal.fromEvent(jsonSignal)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Tables, stint
|
||||
import Tables, stint, chronicles
|
||||
import ./io_interface
|
||||
|
||||
import ../../../global/app_signals
|
||||
|
@ -99,7 +99,7 @@ proc getContactDetails*(self: Controller, contactId: string): ContactDetails =
|
|||
return self.contactsService.getContactDetails(contactId)
|
||||
|
||||
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)
|
||||
|
||||
proc getActivityCenterNotifications*(self: Controller): seq[ActivityCenterNotificationDto] =
|
||||
|
|
|
@ -89,7 +89,7 @@ proc getChannelGroups*(self: Controller): seq[ChannelGroupDto] =
|
|||
return self.chatService.getChannelGroups()
|
||||
|
||||
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)
|
||||
|
||||
proc getChatDetailsForChatTypes*(self: Controller, types: seq[ChatType]): seq[ChatDto] =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import NimQml
|
||||
import NimQml, chronicles
|
||||
import json
|
||||
import io_interface
|
||||
|
||||
|
@ -179,9 +179,9 @@ proc init*(self: Controller) =
|
|||
var args = ChatUpdateArgs(e)
|
||||
for chat in args.chats:
|
||||
if self.chatId == chat.id:
|
||||
echo "Chat content"
|
||||
debug "Chat content", chatId=chat.id
|
||||
self.delegate.onChatEdited(chat)
|
||||
echo "Chat done"
|
||||
debug "Chat done", chatId=chat.id
|
||||
|
||||
proc getMyChatId*(self: Controller): string =
|
||||
return self.chatId
|
||||
|
@ -190,7 +190,7 @@ proc getChatDetails*(self: Controller): ChatDto =
|
|||
return self.chatService.getChatById(self.chatId)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
proc getCommunityDetails*(self: Controller): CommunityDto =
|
||||
echo "getCommunityById from messages module"
|
||||
debug "getCommunityById from messages module", communityId=self.sectionId
|
||||
return self.communityService.getCommunityById(self.sectionId)
|
||||
|
||||
proc getOneToOneChatNameAndImage*(self: Controller):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Tables, sugar, sequtils, strutils
|
||||
import Tables, sugar, sequtils, strutils, chronicles
|
||||
|
||||
import io_interface
|
||||
|
||||
|
@ -156,11 +156,11 @@ proc init*(self: Controller) =
|
|||
var args = ChatUpdateArgs(e)
|
||||
for chat in args.chats:
|
||||
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,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
|
||||
self.mailserversService, setChatAsActive = false)
|
||||
echo "Chat section done"
|
||||
debug "Chat section done", id=chat.id
|
||||
|
||||
self.events.on(SIGNAL_CHAT_CREATED) do(e: Args):
|
||||
var args = CreatedChatArgs(e)
|
||||
|
@ -383,7 +383,7 @@ proc isCommunity*(self: Controller): bool =
|
|||
return self.isCommunitySection
|
||||
|
||||
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)
|
||||
|
||||
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 ../../../core/signals/types
|
||||
|
@ -205,7 +205,7 @@ proc getAllCommunities*(self: Controller): seq[CommunityDto] =
|
|||
result = self.communityService.getAllCommunities()
|
||||
|
||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||
echo "getCommunityById from communities module"
|
||||
debug "getCommunityById from communities module", communityId=communityId
|
||||
result = self.communityService.getCommunityById(communityId)
|
||||
|
||||
proc getCuratedCommunities*(self: Controller): seq[CommunityDto] =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import NimQml, Tables
|
||||
import NimQml, Tables, chronicles
|
||||
import curated_community_item
|
||||
import ../../../shared_models/[token_permissions_model, token_permission_item]
|
||||
|
||||
|
@ -162,6 +162,6 @@ QtObject:
|
|||
proc setPermissionItems*(self: CuratedCommunityModel, itemId: string, items: seq[TokenPermissionItem]) =
|
||||
let idx = self.findIndexById(itemId)
|
||||
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
|
||||
self.items[idx].setPermissionModelItems(items)
|
|
@ -1,4 +1,4 @@
|
|||
import stint
|
||||
import stint, chronicles
|
||||
import ./io_interface as community_tokens_module_interface
|
||||
|
||||
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)
|
||||
|
||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||
echo "getCommunityById from tokens module"
|
||||
debug "getCommunityById from tokens module", 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 ../../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())
|
||||
self.delegate.checkPermissions(communityId, sharedAddresses)
|
||||
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.} =
|
||||
return self.spectatedCommunityPermissionModelVariant
|
||||
|
@ -658,14 +658,14 @@ QtObject:
|
|||
let addressesArray = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||
self.delegate.requestToJoinCommunityWithAuthentication(communityId, ensName, addressesArray, airdropAddress)
|
||||
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.} =
|
||||
try:
|
||||
let addressesArray = map(parseJson(addressesToShare).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||
self.delegate.editSharedAddressesWithAuthentication(communityId, addressesArray, airdropAddress)
|
||||
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.} =
|
||||
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/global_singleton
|
||||
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)
|
||||
|
||||
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||
echo "getCommunityById from main module"
|
||||
debug "getCommunityById from main module", communityId
|
||||
return self.communityService.getCommunityById(communityId)
|
||||
|
||||
proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto =
|
||||
|
|
|
@ -80,9 +80,9 @@ proc init*(self: Controller) =
|
|||
self.events.on(SIGNAL_CHAT_UPDATE) do(e: Args):
|
||||
var args = ChatUpdateArgs(e)
|
||||
for chat in args.chats:
|
||||
echo "notifications"
|
||||
debug "notifications", chatId=chat.id
|
||||
self.delegate.addChat(chat)
|
||||
echo "notifications done"
|
||||
debug "notifications done", chatId=chat.id
|
||||
|
||||
self.events.on(SIGNAL_CHAT_RENAMED) do(e: Args):
|
||||
var args = ChatRenameArgs(e)
|
||||
|
|
|
@ -133,11 +133,11 @@ method addChat*(self: Module, chatDto: ChatDto) =
|
|||
let ind = self.view.exemptionsModel().findIndexForItemId(chatDto.id)
|
||||
if(ind != -1):
|
||||
return
|
||||
echo "Create item"
|
||||
debug "Create item", chatId=chatDto.id
|
||||
let item = self.createChatItem(chatDto)
|
||||
echo "created item"
|
||||
debug "created item", chatId=chatDto.id
|
||||
self.view.exemptionsModel().addItem(item)
|
||||
echo "added item"
|
||||
debug "added item", chatId=chatDto.id
|
||||
|
||||
method addChat*(self: Module, itemId: string) =
|
||||
let ind = self.view.exemptionsModel().findIndexForItemId(itemId)
|
||||
|
|
|
@ -727,7 +727,7 @@ QtObject:
|
|||
return toSeq(self.communities.keys)
|
||||
|
||||
proc getCommunityTokenBySymbol*(self: Service, communityId: string, symbol: string): CommunityTokenDto =
|
||||
echo "getCommunityById from getCommunityTokenBySymbol"
|
||||
debug "getCommunityById from getCommunityTokenBySymbol"
|
||||
let community = self.getCommunityById(communityId)
|
||||
for metadata in community.communityTokensMetadata:
|
||||
if metadata.symbol == symbol:
|
||||
|
@ -2003,7 +2003,7 @@ QtObject:
|
|||
return community.declinedRequestsToJoin[indexDeclined].publicKey
|
||||
|
||||
proc checkChatHasPermissions*(self: Service, communityId: string, chatId: string): bool =
|
||||
echo "getCommunityById from checkChatHasPermissions"
|
||||
debug "getCommunityById from checkChatHasPermissions"
|
||||
let community = self.getCommunityById(communityId)
|
||||
for id, tokenPermission in community.tokenPermissions:
|
||||
if TokenPermissionType(tokenPermission.`type`) == TokenPermissionType.View or TokenPermissionType(tokenPermission.`type`) == TokenPermissionType.ViewAndPost:
|
||||
|
|
Loading…
Reference in New Issue