package miaou-core

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file logger_capability.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(*****************************************************************************)
(*                                                                           *)
(* SPDX-License-Identifier: MIT                                              *)
(* Copyright (c) 2025 Nomadic Labs <contact@nomadic-labs.com>                *)
(*                                                                           *)
(*****************************************************************************)
(* (c) 2025 Nomadic Labs <contact@nomadic-labs.com> *)

[@@@warning "-32-34-37-69"]

type level = Debug | Info | Warning | Error

type t = {
  logf : level -> string -> unit;
  set_enabled : bool -> unit;
  set_logfile : string option -> (unit, string) result;
}

module Capability = Capability

let key : t Capability.key = Capability.create ~name:"Logger"

let set v = Capability.set key v

let get () = Capability.get key

let require () = Capability.require key