class_docstr: Log the results displayed in `learn.path/fname`
class_docstr_tok: ["Log","the","results","displayed","in","`","learn.path\/fname","`"]
docstr: Prepare file with metric names.
docstr_tok: ["Prepare","file","with","metric","names","."]
code: def before_fit(self):
      "Prepare file with metric names."
      if hasattr(self, "gather_preds"):
          return
      self.path.parent.mkdir(parents=True, exist_ok=True)
      self.file = (self.path / self.fname).open(
          "a" if self.append else "w"
      )
      self.file.write(",".join(self.recorder.metric_names) + "\n")
      self.old_logger, self.learn.logger = self.logger, self._write_line
  
imports: from __future__ import annotations
  from ..basics import *
label_desc: Use image node_id 3 for calling the CSVLogger obj's underlying member method code with example usage: obj.before_fit() without return types