package vlt
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A variant of Bolt logging tool
Install
dune-project
Dependency
Authors
Maintainers
Sources
v0.2.5.tar.gz
sha256=756a6cba94204cda45ee767ca5f7e52ec321873dd53de48025c32dba1e03de24
md5=c0f22efcafa1119a9c82ffd9d7422da2
doc/src/vlt/tree.ml.html
Source file tree.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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115(* * This file is part of Bolt. * Copyright (C) 2009-2012 Xavier Clerc. * * Bolt is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Bolt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. *) type logger_info = { name : Name.t; level : Level.t; filter : Filter.t lazy_t; pass : Filter.t lazy_t; layout : Layout.t lazy_t; mode : Mode.t; output : Output.impl lazy_t; } module StringMap = Map.Make (String) type node = { parent : node option; path : Name.t; mutable loggers : logger_info list; mutable children : node StringMap.t; } let root = { parent = None; path = Name.of_list []; loggers = []; children = StringMap.empty; } let close_all () = let rec down node = List.iter (fun x -> try let o = Lazy.force x.output in x.mode#flush o; o#close with _ -> ()) node.loggers; StringMap.iter (fun _ v -> down v) node.children in down root let () = at_exit close_all let rec get_node name_elements path current_node = match name_elements with | hd :: tl -> let path = hd :: path in (try get_node tl path (StringMap.find hd current_node.children) with Not_found -> let new_node = { parent = Some current_node; path = Name.of_list (List.rev path); loggers = []; children = StringMap.empty; } in current_node.children <- StringMap.add hd new_node current_node.children; get_node tl path new_node) | [] -> current_node let get_node name = get_node (Name.to_list name) [] root let register_logger info = Utils.enter_critical_section (); try let node = get_node info.name in node.loggers <- info :: node.loggers; Utils.leave_critical_section () with e -> Utils.leave_critical_section (); raise e let get_loggers name = let rec up node acc = let acc = (node.path, node.loggers) :: acc in match node.parent with | Some p -> up p acc | None -> List.rev acc in Utils.enter_critical_section (); try let node = get_node name in let res = up node [] in Utils.leave_critical_section (); res with e -> Utils.leave_critical_section (); raise e let make_node name = Utils.enter_critical_section (); try ignore (get_node name); Utils.leave_critical_section () with e -> Utils.leave_critical_section (); raise e
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>