Log
Todo
Docstrings (module, models, utilities)
Models
- class indico.modules.logs.models.entries.AppLogEntry(**kwargs)
Log entries for the application.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- data
Type-specific data
- id
The ID of the log entry
- kind
The general kind of operation that was performed
- static log(realm, kind, module, summary, user=None, type_='simple', data=None, meta=None)
- logged_dt
The date/time when the reminder was created
- meta
Non-displayable data
- module
The module the operation was related to (does not need to match something in indico.modules and should be human-friendly but not translated).
- query: IndicoBaseQuery
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model). Can be customized per-model by overridingquery_class.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())instead.
- realm
The general area of the application the entry comes from
- summary
A short one-line description of the logged action. Should not be translated!
- type
The type of the log entry. This needs to match the name of a log renderer.
- user
The user associated with the log entry.
- user_backref_name = 'app_log_entries'
- user_id
The ID of the user associated with the entry.
- class indico.modules.logs.models.entries.CategoryLogEntry(**kwargs)
Log entries for categories.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- category
The Category this log entry is associated with
- category_id
The ID of the category
- data
Type-specific data
- id
The ID of the log entry
- kind
The general kind of operation that was performed
- link_fk_name = 'category_id'
- logged_dt
The date/time when the reminder was created
- meta
Non-displayable data
- module
The module the operation was related to (does not need to match something in indico.modules and should be human-friendly but not translated).
- query: IndicoBaseQuery
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model). Can be customized per-model by overridingquery_class.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())instead.
- realm
The general area of the category the entry comes from
- summary
A short one-line description of the logged action. Should not be translated!
- type
The type of the log entry. This needs to match the name of a log renderer.
- user
The user associated with the log entry.
- user_backref_name = 'category_log_entries'
- user_id
The ID of the user associated with the entry.
- class indico.modules.logs.models.entries.EventLogEntry(**kwargs)
Log entries for events.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- data
Type-specific data
- event
The Event this log entry is associated with
- event_id
The ID of the event
- id
The ID of the log entry
- kind
The general kind of operation that was performed
- link_fk_name = 'event_id'
- locator
Define a smart locator property.
This behaves pretty much like a normal read-only property and the decorated function should return a dict containing the necessary data to build a URL for the object.
This decorator should usually be applied to a method named
locatoras this name is required for get_locator to find it automatically when just passing the object.If you need more than one locator, you can define it like this:
@locator_property def locator(self): return {...} @locator.other def locator(self): return {...}
The
otherlocator can then be accessed by passingobj.locator.otherto the code expecting an object with a locator.
- logged_dt
The date/time when the reminder was created
- meta
Non-displayable data
- module
The module the operation was related to (does not need to match something in indico.modules and should be human-friendly but not translated).
- query: IndicoBaseQuery
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model). Can be customized per-model by overridingquery_class.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())instead.
- realm
The general area of the event the entry comes from
- summary
A short one-line description of the logged action. Should not be translated!
- type
The type of the log entry. This needs to match the name of a log renderer.
- user
The user associated with the log entry.
- user_backref_name = 'event_log_entries'
- user_id
The ID of the user associated with the entry.
- class indico.modules.logs.models.entries.EventLogRealm(*values)
- emails = 5
- event = 1
- management = 2
- participants = 3
- reviewing = 4
- class indico.modules.logs.models.entries.LogDetailsSource(title: str, get_obj: collections.abc.Callable[[int], sqlalchemy.orm.decl_api.Model | None], get_url: collections.abc.Callable[[sqlalchemy.orm.decl_api.Model], str])
- class indico.modules.logs.models.entries.LogEntryBase(**kwargs)
Base model for log entries.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- data = Column(None, JSON(astext_type=Text()), table=None, nullable=False)
Type-specific data
- id = Column(None, Integer(), table=None, primary_key=True, nullable=False)
The ID of the log entry
- kind = Column(None, PyIntEnum(), table=None, nullable=False)
The general kind of operation that was performed
- link_fk_name = None
- logged_dt = Column(None, UTCDateTime(), table=None, nullable=False, default=ColumnDefault(<function now_utc>))
The date/time when the reminder was created
- meta = Column(None, JSONB(astext_type=Text()), table=None, nullable=False)
Non-displayable data
- module = Column(None, String(), table=None, nullable=False)
The module the operation was related to (does not need to match something in indico.modules and should be human-friendly but not translated).
- property object_details
- query: IndicoBaseQuery
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model). Can be customized per-model by overridingquery_class.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())instead.
- render()
Render the log entry to be displayed.
If the renderer is not available anymore, e.g. because of a disabled plugin,
Noneis returned.
- property renderer
- summary = Column(None, String(), table=None, nullable=False)
A short one-line description of the logged action. Should not be translated!
- type = Column(None, String(), table=None, nullable=False)
The type of the log entry. This needs to match the name of a log renderer.
- user = <RelationshipProperty at 0x754001a17c50; no key>
- user_backref_name = None
- user_id = Column(None, Integer(), ForeignKey('users.users.id'), table=None)
- class indico.modules.logs.models.entries.LogKind(*values)
- change = 3
- negative = 4
- other = 1
- positive = 2
- class indico.modules.logs.models.entries.UserLogEntry(**kwargs)
Log entries for users.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- data
Type-specific data
- id
The ID of the log entry
- kind
The general kind of operation that was performed
- link_fk_name = 'target_user_id'
- logged_dt
The date/time when the reminder was created
- meta
Non-displayable data
- module
The module the operation was related to (does not need to match something in indico.modules and should be human-friendly but not translated).
- query: IndicoBaseQuery
A SQLAlchemy query for a model. Equivalent to
db.session.query(Model). Can be customized per-model by overridingquery_class.Warning
The query interface is considered legacy in SQLAlchemy. Prefer using
session.execute(select())instead.
- realm
The general area of the user the entry comes from
- summary
A short one-line description of the logged action. Should not be translated!
- target_user
The User this log entry is associated with
- target_user_id
The ID of the user
- type
The type of the log entry. This needs to match the name of a log renderer.
- user
The user associated with the log entry.
- user_backref_name = 'user_log_entries'
- user_id
The ID of the user associated with the entry.
Utilities
- indico.modules.logs.util.get_log_renderers()
- indico.modules.logs.util.make_diff_log(changes, fields)
Create a value for log data containing change information.
- Parameters:
changes – a dict mapping attributes to
(old, new)tuplesfields – a dict mapping attributes to field metadata. for simple cases this may be a string with the human-friendly title, for more advanced fields it should be a dict containing
title, atypestring and aconvertcallback which will be invoked with a tuple containing the old and new value
- indico.modules.logs.util.render_changes(a, b, type_)
Render the comparison of a and b as HTML.
- Parameters:
a – old value
b – new value
type – the type determining how the values should be compared
- indico.modules.logs.util.serialize_log_entry(entry, tzinfo)
- class indico.modules.logs.renderers.EmailRenderer
- name = 'email'
unique name of the log renderer (matches EventLogEntry.type)
- template_name = 'logs/entry_email.html'
template used to render the log entry
- class indico.modules.logs.renderers.EventLogRendererBase
Base class for event log renderers.
- classmethod get_data(entry)
Return the entry data in a format suitable for the template.
This method may be overridden if the entry’s data needs to be preprocessed before being passed to the template.
It MUST NOT modify entry.data directly.
- name = None
unique name of the log renderer (matches EventLogEntry.type)
- plugin = None
plugin containing this renderer - assigned automatically
- classmethod render_entry(entry)
Render the log entry row.
- Parameters:
entry – A
EventLogEntry
- template_kwargs = {}
extra kwargs passed to render_template
- template_name = None
template used to render the log entry
- class indico.modules.logs.renderers.SimpleRenderer
- classmethod get_data(entry)
Return the entry data in a format suitable for the template.
This method may be overridden if the entry’s data needs to be preprocessed before being passed to the template.
It MUST NOT modify entry.data directly.
- name = 'simple'
unique name of the log renderer (matches EventLogEntry.type)
- template_kwargs = {'compare': <function render_changes>}
extra kwargs passed to render_template
- template_name = 'logs/entry_simple.html'
template used to render the log entry