def __init__(self, file, channel=1):
        """
        :param file: a path-like object or as file-like object to write to
                     If this is a file-like object, is has to opened in text
                     write mode, not binary write mode.
        :param channel: a default channel to use when the message does not
                        have a channel set
        """
        super(ASCWriter, self).__init__(file, mode='w')
        self.channel = channel

        # write start of file header
        now = datetime.now().strftime("%a %b %m %I:%M:%S.%f %p %Y")
        self.file.write("date %s\n" % now)
        self.file.write("base hex  timestamps absolute\n")
        self.file.write("internal events logged\n")

        # the last part is written with the timestamp of the first message
        self.header_written = False
        self.last_timestamp = None
        self.started = None
def __init__ ( self , file , channel = 1 ) : super ( ASCWriter , self ) . __init__ ( file , mode = 'w' ) self . channel = channel now = datetime . now ( ) . strftime ( "%a %b %m %I:%M:%S.%f %p %Y" ) self . file . write ( "date %s\n" % now ) self . file . write ( "base hex  timestamps absolute\n" ) self . file . write ( "internal events logged\n" ) self . header_written = False self . last_timestamp = None self . started = None
:param file: a path-like object or as file-like object to write to
                     If this is a file-like object, is has to opened in text
                     write mode, not binary write mode.
        :param channel: a default channel to use when the message does not
                        have a channel set