mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-04 18:22:26 +00:00
add some trace logging
This commit is contained in:
parent
2209edfb88
commit
b756e21c31
1 changed files with 8 additions and 0 deletions
|
@ -32,6 +32,7 @@ import vobject
|
||||||
|
|
||||||
from radicale import item, xmlutils
|
from radicale import item, xmlutils
|
||||||
from radicale.log import logger
|
from radicale.log import logger
|
||||||
|
from radicale.utils import format_ut
|
||||||
|
|
||||||
DAY: timedelta = timedelta(days=1)
|
DAY: timedelta = timedelta(days=1)
|
||||||
SECOND: timedelta = timedelta(seconds=1)
|
SECOND: timedelta = timedelta(seconds=1)
|
||||||
|
@ -98,6 +99,7 @@ def comp_match(item: "item.Item", filter_: ET.Element, level: int = 0) -> bool:
|
||||||
# HACK: the filters are tested separately against all components
|
# HACK: the filters are tested separately against all components
|
||||||
|
|
||||||
name = filter_.get("name", "").upper()
|
name = filter_.get("name", "").upper()
|
||||||
|
logger.debug("TRACE/ITEM/FILTER/comp_match: name=%s level=%d", name, level)
|
||||||
|
|
||||||
if level == 0:
|
if level == 0:
|
||||||
tag = item.name
|
tag = item.name
|
||||||
|
@ -233,6 +235,7 @@ def time_range_match(vobject_item: vobject.base.Component,
|
||||||
def infinity_fn(start: datetime) -> bool:
|
def infinity_fn(start: datetime) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
logger.debug("TRACE/ITEM/FILTER/time_range_match: start=(%s) end=(%s) child_name=%s", start, end, child_name)
|
||||||
visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn)
|
visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn)
|
||||||
return matched
|
return matched
|
||||||
|
|
||||||
|
@ -289,6 +292,8 @@ def visit_time_ranges(vobject_item: vobject.base.Component, child_name: str,
|
||||||
# recurrences too. This is not respected and client don't seem to bother
|
# recurrences too. This is not respected and client don't seem to bother
|
||||||
# either.
|
# either.
|
||||||
|
|
||||||
|
logger.debug("TRACE/ITEM/FILTER/visit_time_ranges: child_name=%s", child_name)
|
||||||
|
|
||||||
def getrruleset(child: vobject.base.Component, ignore: Sequence[date]
|
def getrruleset(child: vobject.base.Component, ignore: Sequence[date]
|
||||||
) -> Tuple[Iterable[date], bool]:
|
) -> Tuple[Iterable[date], bool]:
|
||||||
infinite = False
|
infinite = False
|
||||||
|
@ -516,6 +521,7 @@ def visit_time_ranges(vobject_item: vobject.base.Component, child_name: str,
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Match a property
|
# Match a property
|
||||||
|
logger.debug("TRACE/ITEM/FILTER/get_children: child_name=%s property match", child_name)
|
||||||
child = getattr(vobject_item, child_name.lower())
|
child = getattr(vobject_item, child_name.lower())
|
||||||
if isinstance(child.value, date):
|
if isinstance(child.value, date):
|
||||||
child_is_datetime = isinstance(child.value, datetime)
|
child_is_datetime = isinstance(child.value, datetime)
|
||||||
|
@ -605,6 +611,7 @@ def simplify_prefilters(filters: Iterable[ET.Element], collection_tag: str
|
||||||
"""
|
"""
|
||||||
flat_filters = list(chain.from_iterable(filters))
|
flat_filters = list(chain.from_iterable(filters))
|
||||||
simple = len(flat_filters) <= 1
|
simple = len(flat_filters) <= 1
|
||||||
|
logger.debug("TRACE/ITEM/FILTER/simplify_prefilters: collection_tag=%s", collection_tag)
|
||||||
for col_filter in flat_filters:
|
for col_filter in flat_filters:
|
||||||
if collection_tag != "VCALENDAR":
|
if collection_tag != "VCALENDAR":
|
||||||
simple = False
|
simple = False
|
||||||
|
@ -632,6 +639,7 @@ def simplify_prefilters(filters: Iterable[ET.Element], collection_tag: str
|
||||||
simple = False
|
simple = False
|
||||||
continue
|
continue
|
||||||
start, end = time_range_timestamps(time_filter)
|
start, end = time_range_timestamps(time_filter)
|
||||||
|
logger.debug("TRACE/ITEM/FILTER/simplify_prefilters: found time-filter on level 1 tag=%s start=%d end=%d simple=%s", tag, start, end, simple)
|
||||||
return tag, start, end, simple
|
return tag, start, end, simple
|
||||||
return tag, TIMESTAMP_MIN, TIMESTAMP_MAX, simple
|
return tag, TIMESTAMP_MIN, TIMESTAMP_MAX, simple
|
||||||
return None, TIMESTAMP_MIN, TIMESTAMP_MAX, simple
|
return None, TIMESTAMP_MIN, TIMESTAMP_MAX, simple
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue