12345678910111213141516171819202122232425262728293031323334353637383940414243444546(*
* This file is part of the Watson Conversation Service OCaml API project.
*
* Copyright 2016-2017 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)exceptionErrorofstring*stringletcolumns=ifs=""then""else": "^sletwarning(module_name:string)(msg:string):unit=Format.eprintf"[Warning%s] %s@."(columnmodule_name)msgleterror_recovery=reftrueletprint_errormodule_namemsg=Format.eprintf"[Error%s] %s@."(columnmodule_name)msgleterror(module_name:string)(default:'aoption)(msg:string):'a=beginmatch!error_recovery,defaultwith|true,Somev->print_errormodule_namemsg;v|false,Some_|_,None->raise(Error(module_name,msg))endletdebug_message=reffalseletdebug(module_name:string)(msg:string):unit=if!debug_messagethenFormat.eprintf"[Debug%s] %s@."(columnmodule_name)msg