Skip to content

Commit

Permalink
Merge pull request #4 from talex5/logging
Browse files Browse the repository at this point in the history
Replace custom logging with Prometheus defaults
  • Loading branch information
talex5 committed Dec 23, 2020
2 parents 6e573c6 + de45ba5 commit 327dc23
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 33 deletions.
1 change: 1 addition & 0 deletions dune-project
Expand Up @@ -13,6 +13,7 @@
(synopsis "An OCurrent pipeline")
(description "A longer description")
(depends
(prometheus-app (>= 1.0))
(current (>= 0.3))
current_web
current_git
Expand Down
1 change: 1 addition & 0 deletions example.opam
Expand Up @@ -8,6 +8,7 @@ homepage: "https://github.com/ocurrent/ocurrent-skeleton"
bug-reports: "https://github.com/ocurrent/ocurrent-skeleton/issues"
depends: [
"dune" {>= "1.11"}
"prometheus-app" {>= "1.0"}
"current" {>= "0.3"}
"current_web"
"current_git"
Expand Down
5 changes: 2 additions & 3 deletions src/dune
Expand Up @@ -7,7 +7,6 @@
current_git
current_web
cmdliner
fmt.tty
logs.fmt
lwt
lwt.unix))
lwt.unix
prometheus-app.unix))
22 changes: 0 additions & 22 deletions src/logging.ml

This file was deleted.

5 changes: 0 additions & 5 deletions src/logging.mli

This file was deleted.

6 changes: 3 additions & 3 deletions src/main.ml
@@ -1,15 +1,15 @@
(* This is the main entry-point for the executable.
Edit [cmd] to set the text for "--help" and modify the command-line interface. *)

let () = Logging.init ()
let () = Prometheus_unix.Logging.init ()

let program_name = "example"

let main config mode repo =
let repo = Current_git.Local.v (Fpath.v repo) in
let engine = Current.Engine.create ~config (Pipeline.v ~repo) in
let site = Current_web.Site.(v ~has_role:allow_all) ~name:program_name (Current_web.routes engine) in
Logging.run begin
Lwt_main.run begin
Lwt.choose [
Current.Engine.thread engine; (* The main thread evaluating the pipeline. *)
Current_web.run ~mode site; (* Optional: provides a web UI *)
Expand All @@ -31,7 +31,7 @@ let repo =

let cmd =
let doc = "an OCurrent pipeline" in
Term.(const main $ Current.Config.cmdliner $ Current_web.cmdliner $ repo),
Term.(term_result (const main $ Current.Config.cmdliner $ Current_web.cmdliner $ repo)),
Term.info program_name ~doc

let () = Term.(exit @@ eval cmd)

0 comments on commit 327dc23

Please sign in to comment.