package miaou-core

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

Source file logger.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
(*****************************************************************************)
(*                                                                           *)
(* SPDX-License-Identifier: MIT                                              *)
(* Copyright (c) 2025 Nomadic Labs <contact@nomadic-labs.com>                *)
(*                                                                           *)
(*****************************************************************************)

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

module Tui_logger = struct
  let set_enabled b =
    match Miaou_interfaces.Logger_capability.get () with
    | Some logger -> logger.set_enabled b
    | None -> ()

  let set_logfile path_opt =
    match Miaou_interfaces.Logger_capability.get () with
    | Some logger -> logger.set_logfile path_opt
    | None -> Ok ()

  let logf fmt =
    match Miaou_interfaces.Logger_capability.get () with
    | Some logger -> Printf.ksprintf (fun msg -> logger.logf Info msg) fmt
    | None -> Printf.ifprintf () fmt
end