2 * Copyright (c) 2015, Facebook, Inc.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
15 let tm = localtime
(time
()) in
16 let year = tm.tm_year
+ 1900 in
17 let time_str = spf
"[%d-%02d-%02d %02d:%02d:%02d]"
18 year (tm.tm_mon
+ 1) tm.tm_mday
tm.tm_hour
tm.tm_min
tm.tm_sec
in
19 Printf.eprintf
"%s %s%!" time_str s
21 (* wraps log_raw in order to take a format string & add a newline *)
22 let log fmt
= Printf.ksprintf
log_raw (fmt^^
"\n")
24 let log_duration name t
=
25 log_raw (name ^
": ");
26 let t2 = Unix.gettimeofday
() in
27 Printf.eprintf
"%f\n%!" (t2 -. t
);