package tiny_httpd

  1. Overview
  2. Docs
Minimal HTTP server using threads

Install

dune-project
 Dependency

Authors

Maintainers

Sources

tiny_httpd-0.17.0.tbz
sha256=67c636f1bbaf93da0cb0a12cb44803299892caf51e637815c753f0af6f4e7b7e
sha512=c254415a69df5a1bec255a223dbc2d10370b2f533da0b14ff458545da7aa5e4a634972272e7eef64425b6360494d6b3446761c03b49fd7558765cbfefae2178b

doc/src/tiny_httpd.core/log.ml.html

Source file log.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 1 "src/core/log.logs.ml"
(* Use Logs *)

module Log = (val Logs.(src_log @@ Src.create "tiny_httpd"))

let info k = Log.info (fun fmt -> k (fun x -> fmt ?header:None ?tags:None x))
let debug k = Log.debug (fun fmt -> k (fun x -> fmt ?header:None ?tags:None x))
let error k = Log.err (fun fmt -> k (fun x -> fmt ?header:None ?tags:None x))

let setup ~debug () =
  let mutex = Mutex.create () in
  Logs.set_reporter_mutex
    ~lock:(fun () -> Mutex.lock mutex)
    ~unlock:(fun () -> Mutex.unlock mutex);
  Logs.set_reporter @@ Logs.format_reporter ();
  Logs.set_level ~all:true
    (Some
       (if debug then
         Logs.Debug
       else
         Logs.Info))

let dummy = false