def process(self, event):
        filename = event.format(self.filename)
        if self.max_size and os.path.exists(filename) and os.path.getsize(filename) > self.max_size:
            self._rotate(filename, self.last_event, event)

        if 'timestamp' in self.filename and self.last_filename != filename:
            if self.last_filename:
                # file has rolled by timestamp
                self._rotate(self.last_filename, self.last_event, event)
            self.last_filename = filename
        self.last_event = event

        dirname = os.path.dirname(filename)
        if dirname and not os.path.exists(dirname):
            os.makedirs(dirname)
        with file(filename, 'a') as fout:
            d = event.to_json()
            self.logger.debug('Writing to %s: %s' % (filename, d))
            print >>fout, d
dataset/ETHPy150Open artirix/logcabin/logcabin/outputs/file.py/File.process/original