~williewillus/r16

42a7870c5861161b1b950aae9e13051d79b081a9 — Vincent Lee 3 months ago a204213
Move r16 log receiver out of Discord frontend
2 files changed, 19 insertions(+), 9 deletions(-)

M frontends/discord.rkt
M main.rkt
M frontends/discord.rkt => frontends/discord.rkt +8 -9
@@ 172,15 172,14 @@

    (define/public (start)
      (define discord-receiver (make-log-receiver rc:discord-logger 'debug))
      (define r16-receiver (make-log-receiver r16-logger 'debug))
      (~>
       (let loop ()
         (let ([v (sync discord-receiver r16-receiver)])
           (printf "[~a] ~a\n"
                   (vector-ref v 0)
                   (vector-ref v 1)))
         (loop))
       thunk thread)
      (thread
       (thunk
        (let loop ()
          (let ([v (sync discord-receiver)])
            (printf "[~a] ~a\n"
                    (vector-ref v 0)
                    (vector-ref v 1)))
          (loop))))
      (~>
       (let loop ()
        (sleep 30)

M main.rkt => main.rkt +11 -0
@@ 12,6 12,7 @@
 "backend.rkt"
 "common.rkt"
 "config.rkt"
 "log.rkt"
 "interface.rkt"
 (prefix-in db: "trick-db.rkt"))



@@ 85,6 86,16 @@
  (define path (hash-ref config 'storage))
  (define db (db:make-trickdb path json->trick))

  (define r16-receiver (make-log-receiver r16-logger 'debug))
  (thread
   (thunk
    (let loop ()
      (let ([v (sync r16-receiver)])
        (printf "[~a] ~a\n"
                (vector-ref v 0)
                (vector-ref v 1)))
      (loop))))

  (parameterize ([current-backend (new r16% [db db])]
                 [current-frontend (make-frontend config)])
    (send (current-frontend) start)))