12345678910111213141516171819202122232425262728openPrintexcmodulePriority=structtypet=|EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|DEBUGexternalto_int:t->int="caml_journal_level_to_int"endexternalcaml_journal_send:stringlist->unit="caml_journal_send"letjournal_sendl=List.map(function(k,v)->k^"="^v)l|>caml_journal_sendletdefault_entriesps=("PRIORITY",((Priority.to_intp)|>string_of_int))::("MESSAGE",s)::[]letjournal_send_messageps=default_entriesps|>journal_send(* assuming get_location is called from function in backtrace 3 slots above *)letget_location()=match(get_callstack3|>backtrace_slots)with|Somes->Array.gets2|>Slot.location|None->Noneletjournal_send_locl=matchget_location()with|Some{filename;line_number;_}->journal_send(("CODE_FILE",filename)::("CODE_LINE",string_of_intline_number)::l)|None->journal_sendlletjournal_send_message_locps=matchget_location()with|Some{filename;line_number;_}->journal_send(("CODE_FILE",filename)::("CODE_LINE",string_of_intline_number)::(default_entriesps))|None->journal_send_messageps