class_docstr: Writers `Record` protocol buffers to an records file one by one.
  
  The `RecordFileWriter` class create an records file in the specified
  directory and asynchronously writes `Record` protocol buffers to this
  file.
class_docstr_tok: ["Writers","`","Record","`","protocol","buffers","to","an","records","file","one","by","one",".","The","`","RecordFileWriter","`","class","create","an","records","file","in","the","specified","directory","and","asynchronously","writes","`","Record","`","protocol","buffers","to","this","file","."]
code: def __init__(
      self,
      logdir,
      max_queue_size=10,
      flush_secs=120,
      filename_suffix="",
      filename="",
  ):
      self._logdir = logdir
      if not bfile.exists(logdir):
          bfile.makedirs(logdir)
  
      if filename:
          if "vdlrecords" in filename:
              self._file_name = bfile.join(logdir, filename)
              if bfile.exists(self._file_name):
                  print(
                      "`{}` is exists, VisualDL will add logs to it.".format(
                          self._file_name
                      )
                  )
          else:
              fn = "vdlrecords.%010d.log%s" % (
                  time.time(),
                  filename_suffix,
              )
              self._file_name = bfile.join(logdir, fn)
              print(
                  "Since the log filename should contain `vdlrecords`, "
                  "the filename is invalid and `{}` will replace `{}`".format(  # noqa: E501
                      fn, filename
                  )
              )
      else:
          self._file_name = bfile.join(
              logdir,
              "vdlrecords.%010d.log%s" % (time.time(), filename_suffix),
          )
  
      self._general_file_writer = bfile.BFile(self._file_name, "wb")
      self._async_writer = _AsyncWriter(
          RecordWriter(self._general_file_writer),
          max_queue_size,
          flush_secs,
      )
      # TODO(shenyuhan) Maybe file_version in future.
      # _record = record_pb2.Record()
      # self.add_record(_record)
      self.flush()
  
imports: from visualdl.io import bfile
  from visualdl.utils.crc32 import masked_crc32c
  from visualdl.proto import record_pb2
  import struct
  import time
  import queue
  import threading
  import os
label_desc: Use image node_id 1 to create a new RecordFileWriter object from inherited base classes: object with example: obj = RecordFileWriter(logdir, max_queue_size, flush_secs, filename_suffix, filename)