1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889(*
* 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/>.
*)typeerror=|Invalid_level_stringofstring|Invalid_level_intofintletstring_of_error=function|Invalid_level_strings->Printf.sprintf"invalid level string %S"s|Invalid_level_inti->Printf.sprintf"invalid level int \"%d\""iexceptionExceptionoferrorlet()=Printexc.register_printer(function|Exceptionerror->Some(string_of_errorerror)|_->None)letfailerror=raise(Exceptionerror)typet=|FATAL|ERROR|WARN|INFO|DEBUG|TRACEletlevels=[FATAL;ERROR;WARN;INFO;DEBUG;TRACE]letto_string=function|FATAL->"FATAL"|ERROR->"ERROR"|WARN->"WARN"|INFO->"INFO"|DEBUG->"DEBUG"|TRACE->"TRACE"letof_stringx=matchString.uppercase_asciixwith|"FATAL"->FATAL|"ERROR"->ERROR|"WARN"->WARN|"INFO"->INFO|"DEBUG"->DEBUG|"TRACE"->TRACE|_->fail(Invalid_level_stringx)letto_int=function|FATAL->0|ERROR->1|WARN->2|INFO->3|DEBUG->4|TRACE->5letof_int=function|0->FATAL|1->ERROR|2->WARN|3->INFO|4->DEBUG|5->TRACE|x->fail(Invalid_level_intx)