class_docstr: A Logfile class with different policies for file creation
class_docstr_tok: ["A","Logfile","class","with","different","policies","for","file","creation"]
docstr: Write data to the log file, if active
docstr_tok: ["Write","data","to","the","log","file",",","if","active"]
code: def log_write(self, data, kind="input"):
      """Write data to the log file, if active"""
  
      # print 'data: %r' % data # dbg
      if self.log_active and data:
          write = self.logfile.write
          if kind == "input":
              if self.timestamp:
                  write(
                      time.strftime(
                          "# %a, %d %b %Y %H:%M:%S\n", time.localtime()
                      )
                  )
              write(data)
          elif kind == "output" and self.log_output:
              odata = "\n".join(
                  ["#[Out]# %s" % s for s in data.splitlines()]
              )
              write("%s\n" % odata)
          try:
              self.logfile.flush()
          except OSError:
              print("Failed to flush the log file.")
              print(
                  f"Please check that {self.logfname} exists and have the right permissions."
              )
              print(
                  "Also consider turning off the log with `%logstop` to avoid this warning."
              )
  
file_path: catboost/contrib/python/ipython/py3/IPython/core/logger.py
imports: import glob
  import io
  import logging
  import os
  import time
label_desc: Use image node_id 8 for calling the Logger obj's underlying member method code with example usage: obj.log_write(data, kind) without return types