agent: send log events to user

This commit is contained in:
Evgeny Poberezkin
2024-05-18 14:23:10 +01:00
parent 1116aeeea1
commit 71489fe6fc
6 changed files with 121 additions and 41 deletions
+5 -1
View File
@@ -39,7 +39,7 @@ import Data.Time.Format.ISO8601
import Data.Word (Word16, Word32)
import Simplex.Messaging.Encoding
import Simplex.Messaging.Parsers (parseAll)
import Simplex.Messaging.Util ((<$?>))
import Simplex.Messaging.Util (safeDecodeUtf8, (<$?>))
class TextEncoding a where
textEncode :: a -> Text
@@ -81,6 +81,10 @@ instance StrEncoding String where
strEncode = strEncode . B.pack
strP = B.unpack <$> strP
instance StrEncoding Text where
strEncode = strEncode . encodeUtf8
strP = safeDecodeUtf8 <$> A.takeByteString
instance ToJSON Str where
toJSON (Str s) = strToJSON s
toEncoding (Str s) = strToJEncoding s