Add delete file record to edit log
966420
public void logDelete(String src, long timestamp) {
    DeleteOp op = DeleteOp.getInstance();
    op.set(src, timestamp);
    logEdit(op);
  }
1017427
def add_fields(self, log_record, record, message_dict):
        
        for field in self._required_fields:
            log_record[field] = record.__dict__.get(field)
        log_record.update(message_dict)
        merge_record_extra(record, log_record, reserved=self._skip_fields)

        if self.timestamp:
            key = self.timestamp if type(self.timestamp) == str else 'timestamp'
            log_record[key] = datetime.utcnow()
303308
def add_log_handler(log, handler=None, debug=None, fmt=None):
    
    if debug:
        log.setLevel(debug)
    if handler:
        # if not fmt:
        #     fmt = __LOG_FMT
        if fmt:
            handler.setFormatter(fmt)
        log.addHandler(handler)
284494
def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
        """"""
        records = self._raw_records(identifier, rtype, name, content)
        LOGGER.debug('delete_records: %s', [rec['id'] for rec in records])
        self._update_records(records, {
            'deleterecord': True,
            'type': rtype,
            'hostname': name,
            'destination': content,
        })
        LOGGER.debug('delete_record: %s', True)
        return True
1123074
public void addListener(Record record, FileListener listener)
    {
        record.doAddListener(listener);
        boolean bOldState = listener.setEnabledListener(false);      // To disable recursive forever loop!
        BaseListener nextListener = listener.setNextListener(null);     // Make sure this is the ONLY listener in the chain to get this call
        if (record.getEditMode() == Constants.EDIT_ADD)
        {
            boolean[] rgbModified = this.getRecord().getModified();
            listener.doNewRecord(DBConstants.DISPLAY);
            this.getRecord().setModified(rgbModified);   // Restore since doNew should not change modified fields.
        }
        else if ((record.getEditMode() == Constants.EDIT_IN_PROGRESS) || (record.getEditMode() == Constants.EDIT_CURRENT))
            listener.doValidRecord(DBConstants.DISPLAY);
        listener.setNextListener(nextListener);
        listener.setEnabledListener(bOldState);   // Renable the listener to eliminate echos
    }
885595
def set_up_logging(log_filename: str = "log", verbosity: int = 0) ->logging.Logger:
    """"""
    LOG.setLevel(logging.DEBUG)

    # Log everything verbosely to a file.
    file_handler = RotatingFileHandler(filename=log_filename, maxBytes=1024000000, backupCount=10)
    verbose_form = logging.Formatter(fmt="%(asctime)s - %(levelname)s - %(module)s - %(message)s")
    file_handler.setFormatter(verbose_form)
    file_handler.setLevel(logging.DEBUG)
    LOG.addHandler(file_handler)

    # Provide a stdout handler logging at INFO.
    stream_handler = logging.StreamHandler(sys.stdout)
    simple_form = logging.Formatter(fmt="%(message)s")
    stream_handler.setFormatter(simple_form)

    if verbosity > 0:
        stream_handler.setLevel(logging.DEBUG)
    else:
        stream_handler.setLevel(logging.INFO)

    LOG.addHandler(stream_handler)

    return LOG
467783
def close_log(log_file):
    
    sys.stdout = sys.__stdout__
    if log_file is not None:
        log_file.close()
        del log_file
8866
def add_log_entry(self, entry):
        
        event_log = self.job_record.event_log
        if len(event_log) > job.MAX_NUMBER_OF_EVENTS:
            del event_log[-1]
        event_log.insert(0, entry)
805789
protected function __save()
    {
        foreach($this->records as $record)
        {
            $content = $this->getLogString($record);
            if($this->length > 0)
            {
                $content = mb_substr($content, 0, $this->length) . '...';
            }
            echo $content, PHP_EOL;
        }
    }
923902
public function update_logging()
    {
        $config = $this->app->make('config');
        if (!$this->token->validate('update_logging')) {
            $this->error->add($this->token->getErrorMessage());
        }
        if ($this->request->request->get('handler') == 'file' && $this->request->request->get('logging_mode')) {
            $logFile = $this->request->request->get('logFile');
            $filesystem = new Filesystem();
            $directory = dirname($logFile);
            if ($filesystem->isFile($logFile) && !$filesystem->isWritable($logFile)) {
                $this->error->add(t('Log file exists but is not writable by the web server.'));
            }
            if (!$filesystem->isFile($logFile) && (!$filesystem->isDirectory($directory) || !$filesystem->isWritable($directory))) {
                $this->error->add(t('Log file does not exist on the server. The directory of the file provided must exist and be writable on the web server.'));
            }
            $filename = basename($logFile);
            if (!$filename || substr($filename, -4) != '.log') {
                $this->error->add(t('The filename provided must be a valid filename and end with .log'));
            }
        }
        if (!$this->error->has()) {
            $intLogErrorsPost = $this->post('ENABLE_LOG_ERRORS') == 1 ? 1 : 0;
            $intLogEmailsPost = $this->post('ENABLE_LOG_EMAILS') == 1 ? 1 : 0;

            $config->save('concrete.log.errors', $intLogErrorsPost);
            $config->save('concrete.log.emails', $intLogEmailsPost);

            $mode = $this->request->request->get('logging_mode');
            if ($mode != 'advanced') {
                $mode = 'simple';
                $config->save('concrete.log.configuration.simple.core_logging_level',
                    $this->request->request->get('logging_level')
                );
                $config->save('concrete.log.configuration.simple.handler',
                    $this->request->request->get('handler')
                );
                $config->save('concrete.log.configuration.simple.file.file',
                    $this->request->request->get('logFile')
                );
            }
            $config->save('concrete.log.enable_dashboard_report',
                $this->request->request->get('enable_dashboard_report') ? true : false);
            $config->save('concrete.log.configuration.mode', $mode);

            $this->redirect('/dashboard/system/environment/logging', 'logging_saved');
        }
        $this->view();
    }
1217930
def on_deleted(self, event):
        
        logger.debug("File deleted: %s", event.src_path)
        if not event.is_directory:
            self.update_file(event.src_path)
303061
def log_to_file(logdir, mode='a', delete=False, clearmem=True):
    
    logger = FileLogger(logdir, mode, delete, clearmem)
    _loggers.append(logger)
    return log_to(logger)
398364
def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
        """"""
        return self._change_record_sets('DELETE', rtype, name, content)
550307
def capture_delete_records(records):
    """"""
    for record in records:
        model = create_delete_model(record)
        if model:
            try:
                model.delete(condition=(CurrentVPCModel.eventTime <= record['detail']['eventTime']))
            except DeleteError:
                LOG.warning(f'[?] Unable to delete VPC. VPC does not exist. Record: {record}')
        else:
            LOG.warning(f'[?] Unable to delete VPC. VPC does not exist. Record: {record}')
666263
def __record(self):
        """"""
        f = self.__getFileObj(self.dbf)
        recFmt = self.__recordFmt()
        recordContents = unpack(recFmt[0], f.read(recFmt[1]))
        if recordContents[0] != b(' '):
            # deleted record
            return None
        record = []
        for (name, typ, size, deci), value in zip(self.fields,
                                                                                                recordContents):
            if name == 'DeletionFlag':
                continue
            elif not value.strip():
                record.append(value)
                continue
            elif typ == "N":
                value = value.replace(b('\0'), b('')).strip()
                if value == b(''):
                    value = 0
                elif deci:
                    try:
                        value = float(value)
                    except ValueError:
                        value = 0
                else:
                    value = int(value)
            elif typ == b('D'):
                try:
                    y, m, d = int(value[:4]), int(value[4:6]), int(value[6:8])
                    value = [y, m, d]
                except:
                    value = value.strip()
            elif typ == b('L'):
                value = (value in b('YyTt') and b('T')) or \
                                        (value in b('NnFf') and b('F')) or b('?')
            else:
                value = u(value)
                value = value.strip()
            record.append(value)
        return record
207139
def setup_prefix_logging(logdir):
    
    if not os.path.exists(logdir):
        os.mkdir(logdir)

    file_handler = logging.FileHandler(
        filename=os.path.join(logdir, 'lago.log'),
    )
    file_formatter = get_default_log_formatter()
    file_handler.setFormatter(file_formatter)
    logging.root.addHandler(file_handler)
    hide_paramiko_logs()
    hide_stevedore_logs()
612347
def create_log(log_file, uid):
    
    if not os.path.exists(log_file):  # create new log file
        dir_name = os.path.dirname(log_file)
        if not os.path.exists(dir_name):
            os.makedirs(dir_name, 0755)
            os.chown(dir_name, uid, -1)

        with open(log_file, "w") as f:
            f.write("")

    os.chown(log_file, uid, -1)
    os.chmod(log_file, 0640)