Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Dream.debug" doesn't seem to be working #388

Open
boechat107 opened this issue Feb 27, 2025 · 0 comments
Open

"Dream.debug" doesn't seem to be working #388

boechat107 opened this issue Feb 27, 2025 · 0 comments

Comments

@boechat107
Copy link

I used a modified version of the example 2-middleware to test logging, and I couldn't figure out why Dream.debug is not producing any messages even when setting the logging level to Debug.

let () =
  Dream.initialize_log ~level:`Debug ();
  Dream.run
  @@ Dream.logger
  @@ fun _ ->
      Dream.debug (fun log -> log "hello %s" "world");
      Dream.html "Good morning, world!"

If I replace Dream.debug with Dream.info, I see the expected logging message. I also added SQL sessions to check if I get any debug message:

let () =
  Dream.initialize_log ~level:`Debug ();
  Dream.run
  @@ Dream.logger
  @@ Dream.sql_pool "sqlite3:test.sqlite"
  @@ Dream.sql_sessions
  @@ fun _ ->
      Dream.debug (fun log -> log "hello %s" "world");
      Dream.html "Good morning, world!"

This version produces debug messages describing the queries executed to get sessions, but I still couldn't see my "hello world":

27.02.25 13:37:59.436                       Running at http://localhost:8080
27.02.25 13:37:59.436                       Type Ctrl+C to stop
27.02.25 13:38:10.657    dream.logger  INFO REQ 1 GET / ::1:53645 fd 8 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
27.02.25 13:38:10.660   caqti.request DEBUG REQ 1 Sending (unit -->. unit) {|PRAGMA foreign_keys = ON|}
27.02.25 13:38:10.662   caqti.request DEBUG REQ 1 Sending (string -->? string × float × string) {|SELECT label, expires_at, payload FROM dream_session WHERE id = $1|}
27.02.25 13:38:10.663    dream.logger  INFO REQ 1 200 in 6141 μs

Am I missing anything?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant