mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-26 15:18:01 +00:00
* teminal: option to log errors and service messages to file, closes #1516 * rename function
This commit is contained in:
committed by
GitHub
parent
38b7e4d4a4
commit
2b77920dcd
@@ -4,6 +4,7 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
@@ -165,7 +166,8 @@ data ChatController = ChatController
|
||||
expireCIFlags :: TMap UserId Bool,
|
||||
cleanupManagerAsync :: TVar (Maybe (Async ())),
|
||||
timedItemThreads :: TMap (ChatRef, ChatItemId) (TVar (Maybe (Weak ThreadId))),
|
||||
showLiveItems :: TVar Bool
|
||||
showLiveItems :: TVar Bool,
|
||||
logFilePath :: Maybe FilePath
|
||||
}
|
||||
|
||||
data HelpSection = HSMain | HSFiles | HSGroups | HSMyAddress | HSMarkdown | HSMessages | HSSettings
|
||||
@@ -487,6 +489,25 @@ data ChatResponse
|
||||
| CRChatError {user_ :: Maybe User, chatError :: ChatError}
|
||||
deriving (Show, Generic)
|
||||
|
||||
logResponseToFile :: ChatResponse -> Bool
|
||||
logResponseToFile = \case
|
||||
CRContactsDisconnected {} -> True
|
||||
CRContactsSubscribed {} -> True
|
||||
CRContactSubError {} -> True
|
||||
CRMemberSubError {} -> True
|
||||
CRSndFileSubError {} -> True
|
||||
CRRcvFileSubError {} -> True
|
||||
CRHostConnected {} -> True
|
||||
CRHostDisconnected {} -> True
|
||||
CRConnectionDisabled {} -> True
|
||||
CRAgentRcvQueueDeleted {} -> True
|
||||
CRAgentConnDeleted {} -> True
|
||||
CRAgentUserDeleted {} -> True
|
||||
CRChatCmdError {} -> True
|
||||
CRChatError {} -> True
|
||||
CRMessageError {} -> True
|
||||
_ -> False
|
||||
|
||||
instance ToJSON ChatResponse where
|
||||
toJSON = J.genericToJSON . sumTypeJSON $ dropPrefix "CR"
|
||||
toEncoding = J.genericToEncoding . sumTypeJSON $ dropPrefix "CR"
|
||||
|
||||
Reference in New Issue
Block a user