def add_entry_v1(entry): blocked_events = get_events_to_reject() if entry.event_name in blocked_events: get_logger().info('Rejecting %s' % entry.event_name) return with get_client(version=1) as client: client.add(entry)
def query(self, time_from=None, time_until=None, tag=None, event=None, username=None, hostname=None, message=None): with get_client(version=1) as client: if time_until: time_until = datetime.strptime(time_until, '%Y-%m-%d') time_until = (time_until + timedelta(days=1)).strftime('%Y-%m-%d') entries = client.query(time_from=time_from, time_until=time_until, tag=tag, event=event, username=username, hostname=hostname, message=message, locale=self.locale.language) result = [] for entry in entries: res_entry = self._format_entry(entry, client) result.append(res_entry) return sorted(result, key=lambda x: x['date'])
def get(self, context_id): with get_client(version=1) as client: entries = client.get(context_id) result = [] for entry in entries: res_entry = self._format_entry(entry, client) result.append(res_entry) return sorted(result, key=lambda x: x['id'])
def options(self): with get_client(version=1) as client: return client.options()