aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdelyn Breelove <[email protected]>2019-01-21 09:54:34 -0700
committerAdelyn Breelove <[email protected]>2019-01-21 09:54:34 -0700
commit7d254ed478a014afff83fa291e5568b3596dfce0 (patch)
tree4b1d0f39bd30f71efe7e4a3072880afc68df2989
parentfinish making model signatures (diff)
downloaddisml-7d254ed478a014afff83fa291e5568b3596dfce0.tar.xz
disml-7d254ed478a014afff83fa291e5568b3596dfce0.zip
start using Logs
-rw-r--r--bin/bot.ml4
-rw-r--r--lib/dune2
-rw-r--r--lib/event.ml2
-rw-r--r--lib/sharder.ml2
4 files changed, 6 insertions, 4 deletions
diff --git a/bin/bot.ml b/bin/bot.ml
index c069084..1aae20b 100644
--- a/bin/bot.ml
+++ b/bin/bot.ml
@@ -52,6 +52,9 @@ let check_command (msg:Message.t) =
| _ -> ()
let main () =
+ Logs.set_reporter (Logs_fmt.reporter ());
+ Logs.set_level ~all:true (Some Logs.Debug);
+ Client.message_create := check_command;
let token = match Sys.getenv "DISCORD_TOKEN" with
| Some t -> t
| None -> failwith "No token in env"
@@ -60,5 +63,4 @@ let main () =
>>> ignore
let _ =
- Client.message_create := check_command;
Scheduler.go_main ~main ()
diff --git a/lib/dune b/lib/dune
index f3888e0..a5a2e6e 100644
--- a/lib/dune
+++ b/lib/dune
@@ -19,7 +19,7 @@
user user_t
client client_options dispatch endpoints event http opcode rl sharder
)
- (libraries core async_ssl cohttp-async yojson websocket-async zlib ppx_deriving_yojson.runtime)
+ (libraries core async_ssl cohttp-async logs yojson websocket-async zlib ppx_deriving_yojson.runtime)
(preprocess (pps ppx_jane ppx_deriving_yojson))
)
diff --git a/lib/event.ml b/lib/event.ml
index 7f843d7..9b12792 100644
--- a/lib/event.ml
+++ b/lib/event.ml
@@ -120,4 +120,4 @@ let handle_event ~ev contents =
try
event_of_yojson ~contents ev
|> dispatch
- with Invalid_event ev -> Printf.printf "Unknown event: %s\n%!" ev \ No newline at end of file
+ with Invalid_event ev -> Logs.debug (fun m -> m "Unknown event: %s" ev); \ No newline at end of file
diff --git a/lib/sharder.ml b/lib/sharder.ml
index 9ad0022..f03c7dd 100644
--- a/lib/sharder.ml
+++ b/lib/sharder.ml
@@ -33,7 +33,7 @@ module Shard = struct
| `Eof -> None
let push_frame ?payload ~ev shard =
- print_endline @@ "Pushing frame. OP: " ^ Opcode.to_string @@ ev;
+ Logs.debug (fun m -> m "Pushing frame with Opcode: %s" (Opcode.to_string ev));
let content = match payload with
| None -> ""
| Some p ->