log when sending commands

This commit is contained in:
Evgeny Poberezkin
2024-12-06 00:36:00 +00:00
parent 744c796981
commit 94a10dc971

View File

@@ -10,6 +10,7 @@ module Simplex.Chat.Mobile where
import Control.Concurrent.STM
import Control.Exception (SomeException, catch)
import Control.Logger.Simple
import Control.Monad.Except
import Control.Monad.Reader
import qualified Data.Aeson as J
@@ -266,7 +267,7 @@ handleErr :: IO () -> IO String
handleErr a = (a $> "") `catch` (pure . show @SomeException)
chatSendCmd :: ChatController -> B.ByteString -> IO JSONByteString
chatSendCmd cc = chatSendRemoteCmd cc Nothing
chatSendCmd cc = withGlobalLogging logCfg . chatSendRemoteCmd cc Nothing
chatSendRemoteCmd :: ChatController -> Maybe RemoteHostId -> B.ByteString -> IO JSONByteString
chatSendRemoteCmd cc rh s = J.encode . APIResponse Nothing rh <$> runReaderT (execChatCommand rh s) cc