class_docstr: A Logfile class with different policies for file creation
class_docstr_tok: ["A","Logfile","class","with","different","policies","for","file","creation"]
docstr: Switch logging on/off. val should be ONLY a boolean.
docstr_tok: ["Switch","logging","on\/off",".","val","should","be","ONLY","a","boolean","."]
code: def switch_log(self, val):
      """Switch logging on/off. val should be ONLY a boolean."""
  
      if val not in [False, True, 0, 1]:
          raise ValueError(
              "Call switch_log ONLY with a boolean argument, "
              "not with: %s" % val
          )
  
      label = {0: "OFF", 1: "ON", False: "OFF", True: "ON"}
  
      if self.logfile is None:
          print(
              """
  Logging hasn't been started yet (use logstart for that).
  
  %logon/%logoff are for temporarily starting and stopping logging for a logfile
  which already exists. But you must first start the logging process with
  %logstart (optionally giving a logfile name)."""
          )
  
      else:
          if self.log_active == val:
              print("Logging is already", label[val])
          else:
              print("Switching logging", label[val])
              self.log_active = not self.log_active
              self.log_active_out = self.log_active
  
file_path: catboost/contrib/python/ipython/py2/IPython/core/logger.py
imports: from __future__ import print_function
  import glob
  import io
  import os
  import time
  from IPython.utils.py3compat import str_to_unicode
label_desc: Use image node_id 5 for calling the Logger obj's underlying member method code with example usage: obj.switch_log(val) without return types