def log(self, realm, kind, module, summary, user=None, type_='simple', data=None, meta=None): """Create a new log entry for the event. :param realm: A value from :class:`.EventLogRealm` indicating the realm of the action. :param kind: A value from :class:`.EventLogKind` indicating the kind of the action that was performed. :param module: A human-friendly string describing the module related to the action. :param summary: A one-line summary describing the logged action. :param user: The user who performed the action. :param type_: The type of the log entry. This is used for custom rendering of the log message/data :param data: JSON-serializable data specific to the log type. :param meta: JSON-serializable data that won't be displayed. :return: The newly created `EventLogEntry` In most cases the ``simple`` log type is fine. For this type, any items from data will be shown in the detailed view of the log entry. You may either use a dict (which will be sorted) alphabetically or a list of ``key, value`` pairs which will be displayed in the given order. """ if self.__logging_disabled: return entry = EventLogEntry(user=user, realm=realm, kind=kind, module=module, type=type_, summary=summary, data=(data or {}), meta=(meta or {})) self.log_entries.append(entry) return entry
def _migrate_log(self, item): user = None if (item._responsibleUser and item._responsibleUser.__class__.__name__ == 'Avatar' and unicode(item._responsibleUser.id).isdigit()): user = self.global_ns.avatar_merged_user.get( item._responsibleUser.id) module = item._module or 'Unknown' if module.startswith('MaKaC/plugins/Collaboration'): module = 'Collaboration' elif module == 'chat' or module.startswith( 'MaKaC/plugins/InstantMessaging/XMPP'): module = 'Chat' elif module == 'vc_vidyo': module = 'Vidyo' elif module == 'Timetable/SubContribution': module = 'Timetable/Subcontribution' elif module.islower(): module = module.title() entry = EventLogEntry(event_new=self.event, logged_dt=self._naive_to_aware(item._logDate), module=module, user=user, kind=EventLogKind.other) return entry
def resend_failed_email(path): """Try re-sending an email that previously failed.""" from indico.modules.events.logs import EventLogEntry with open(path, 'rb') as f: email, log_entry_id = cPickle.load(f) log_entry = EventLogEntry.get(log_entry_id) if log_entry_id is not None else None do_send_email(email, log_entry) db.session.commit() os.remove(path) return email
def resend_failed_email(path): """Try re-sending an email that previously failed.""" from indico.modules.events.logs import EventLogEntry with open(path, 'rb') as f: email, log_entry_id = pickle.load(f) log_entry = EventLogEntry.get(log_entry_id) if log_entry_id is not None else None do_send_email(email, log_entry) db.session.commit() os.remove(path) return email
def _migrate_log(self, event, item): user_id = None if (item._responsibleUser and item._responsibleUser.__class__.__name__ in {'Avatar', 'AvatarUserWrapper'} and unicode(item._responsibleUser.id).isdigit()): user_id = self.users.get(int(item._responsibleUser.id)) module = item._module or 'Unknown' if module.startswith('MaKaC/plugins/Collaboration'): module = 'Collaboration' elif module == 'chat' or module.startswith( 'MaKaC/plugins/InstantMessaging/XMPP'): module = 'Chat' elif module == 'vc_vidyo': module = 'Vidyo' elif module == 'Timetable/SubContribution': module = 'Timetable/Subcontribution' elif module.islower(): module = module.title() entry = EventLogEntry(event=event, logged_dt=item._logDate, module=module, user_id=user_id, kind=EventLogKind.other) return entry