let call_if log_channel f =
  match log_channel with
  | None -> ()
  | Some x -> f x