teminal: option to log errors and service messages to file, closes #1516 (#1957)

* teminal: option to log errors and service messages to file, closes #1516

* rename function
This commit is contained in:
Evgeny Poberezkin authored and GitHub committed 2023-02-28 23:26:08 +00:00
1 parent 38b7e4d4a4
commit 2b77920dcd
7 files changed
+69 -20

No files matched your search

+6 -5
View File
@@ -14,11 +14,12 @@ import Simplex.Chat.Types
import UnliftIO.Async
simplexChatCore :: ChatConfig -> ChatOpts -> Maybe (Notification -> IO ()) -> (User -> ChatController -> IO ()) -> IO ()
simplexChatCore cfg@ChatConfig {yesToMigrations} opts@ChatOpts {coreOptions = CoreChatOpts {dbFilePrefix, dbKey, logAgent}} sendToast chat
| logAgent = do
setLogLevel LogInfo -- LogError
withGlobalLogging logCfg initRun
| otherwise = initRun
simplexChatCore cfg@ChatConfig {yesToMigrations} opts@ChatOpts {coreOptions = CoreChatOpts {dbFilePrefix, dbKey, logAgent}} sendToast chat =
case logAgent of
Just level -> do
setLogLevel level
withGlobalLogging logCfg initRun
_ -> initRun
where
initRun = do
db@ChatDatabase {chatStore} <- createChatDatabase dbFilePrefix dbKey yesToMigrations