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
open Common
let log config cmd extra_args =
config |> do_option (fun server ->
let unixname = Common2.unixname() in
let extra_args =
match extra_args with
| Some s -> s
| None -> ""
in
let str = spf "unixname:%s\nextra_args:%s" unixname extra_args in
let tmpfile = Common.new_temp_file "logger" "json" in
Common.write_file tmpfile str;
let cmd =
spf "curl http://%s/_rest_/%s/ --data @%s 2>/dev/null 1>/dev/null"
server cmd tmpfile in
profile_code "pfff_logger" (fun () ->
try
timeout_function 1 (fun () ->
command2 cmd
) with Timeout -> ()
)
)