docstr: Should the handler flush its buffer
  
  Returns true if the buffer is up to capacity. This method can be
  overridden to implement custom flushing strategies.
docstr_tok: ["Should","the","handler","flush","its","buffer","Returns","true","if","the","buffer","is","up","to","capacity",".","This","method","can","be","overridden","to","implement","custom","flushing","strategies","."]
code: def shouldFlush(self, record):
      """
      Should the handler flush its buffer
  
      Returns true if the buffer is up to capacity. This method can be
      overridden to implement custom flushing strategies.
      """
      if self._task_id is None:
          return False
  
      # if we need to add handlers to the base_logger,
      # it will not automatically create stream one when first used, so we must manually configure it.
      if not TaskHandler.__once:
          base_logger = getLogger()
          if len(base_logger.handlers) == 1 and isinstance(
              base_logger.handlers[0], TaskHandler
          ):
              if (
                  record.name != "console"
                  and not record.name.startswith("trains.")
              ):
                  base_logger.removeHandler(self)
                  basicConfig()
                  base_logger.addHandler(self)
                  TaskHandler.__once = True
          else:
              TaskHandler.__once = True
  
      # if we passed the max buffer
      return (
          self.counter >= self.capacity
          and self._background_log
          and self._background_log_size >= self.capacity
      )
  
imports: import json
  import sys
  from pathlib2 import Path
  from logging import LogRecord, getLogger, basicConfig, getLevelName, INFO, WARNING, Formatter, makeLogRecord, warning
  from logging.handlers import BufferingHandler
  from .development.worker import DevWorker
  from ...backend_api.services import events
  from ...backend_api.session.session import MaxRequestSizeError
  from ...config import config
  from ...utilities.process.mp import BackgroundMonitor, ForkEvent, ForkQueue
  from ...utilities.process.mp import SafeQueue, SafeEvent
label_desc: Use image node_id 5 for calling the TaskHandler obj's underlying member method code with example usage: obj.shouldFlush(record) and returns: unknown, False