Add logs function for better runtime documentation

pull/27/head
Bram 2024-06-03 11:05:06 +02:00
parent a514497406
commit f714438dd4
1 changed files with 24 additions and 2 deletions

View File

@ -1,6 +1,6 @@
module Matrix exposing
( Vault, fromUserId, fromUsername
, VaultUpdate, update
, VaultUpdate, update, logs
, addAccessToken, sendMessageEvent
)
@ -24,7 +24,7 @@ support a monolithic public registry. (:
## Keeping the Vault up-to-date
@docs VaultUpdate, update
@docs VaultUpdate, update, logs
## Debugging
@ -112,6 +112,28 @@ fromUsername { username, host, port_ } =
|> Vault
{-| The VaultUpdate is a complex type that helps update the Vault. However,
it also contains a human output!
Using this function, you can get a human output that describes everything that
the VaultUpdate has to tell the Vault.
The `channel` field describes the context of the log, allowing you to filter
further. For example:
- `debug` is a comprehensive channel describing everything the Elm runtime has
executed.
- `warn` contains warnings that aren't breaking, but relevant.
- `securityWarn` warns about potential security issues or potential attacks.
- `error` has errors that were encountered.
- `caughtError` has errors that were dealt with successfully.
-}
logs : VaultUpdate -> List { channel : String, content : String }
logs (VaultUpdate vu) =
vu.logs
{-| Send a message event to a room.
This function can be used in a scenario where the user does not want to sync