add char event which triggers log
This commit is contained in:
@@ -2,6 +2,7 @@ structure UpdateThread =
|
|||||||
struct
|
struct
|
||||||
open CML
|
open CML
|
||||||
open MailboxType
|
open MailboxType
|
||||||
|
open InputMsg
|
||||||
|
|
||||||
fun sendMsg (msg, drawMailbox) =
|
fun sendMsg (msg, drawMailbox) =
|
||||||
case msg of DRAW msg => Mailbox.send (drawMailbox, msg)
|
case msg of DRAW msg => Mailbox.send (drawMailbox, msg)
|
||||||
@@ -17,6 +18,16 @@ struct
|
|||||||
fun loop (app: AppType.app_type, inputMailbox, drawMailbox) =
|
fun loop (app: AppType.app_type, inputMailbox, drawMailbox) =
|
||||||
let
|
let
|
||||||
val inputMsg = Mailbox.recv inputMailbox
|
val inputMsg = Mailbox.recv inputMailbox
|
||||||
|
val () =
|
||||||
|
(* if a certain CHAR_EVENT is sent,
|
||||||
|
* we trigger an exception and log the command history.
|
||||||
|
* This is helpful for manually triggering logs when,
|
||||||
|
* for example, we encounter a bug and would like to see
|
||||||
|
* the history of events that caused it. *)
|
||||||
|
case inputMsg of
|
||||||
|
CHAR_EVENT #"~" => ExceptionLogger.log (Fail "")
|
||||||
|
| _ => ()
|
||||||
|
|
||||||
val () = ExceptionLogger.addCommand inputMsg
|
val () = ExceptionLogger.addCommand inputMsg
|
||||||
|
|
||||||
val app = AppUpdate.update (app, inputMsg) handle e => ExceptionLogger.log e
|
val app = AppUpdate.update (app, inputMsg) handle e => ExceptionLogger.log e
|
||||||
|
|||||||
Reference in New Issue
Block a user