mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Made debug be even better
This commit is contained in:
parent
a24b2cee39
commit
0d672f7519
|
@ -13,6 +13,7 @@
|
|||
"pg_pass": "secret_password",
|
||||
"pg_port": "5432",
|
||||
"redis_host": "localhost",
|
||||
"ignored": [],
|
||||
"irc_servers": {
|
||||
"your custom name for the farm": {
|
||||
"domains": ["wikipedia.org", "otherwikipedia.org"],
|
||||
|
@ -23,6 +24,15 @@
|
|||
"irc_channel_mapping": {"rc": "#rcchannel", "discussion": "#discussionchannel"}
|
||||
}
|
||||
},
|
||||
"appearance":{
|
||||
"mode": "whatever",
|
||||
"embed": {
|
||||
"show_edit_changes": true,
|
||||
"show_footer": true,
|
||||
"embed_images": true,
|
||||
"show_no_description_provided": true
|
||||
}
|
||||
},
|
||||
"logging": {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": false,
|
||||
|
|
|
@ -56,7 +56,7 @@ class Domain:
|
|||
if self.task:
|
||||
self.task.cancel()
|
||||
|
||||
def get_wiki(self, item, default=None) -> Optional[src.wiki.Wiki]:
|
||||
def get_wiki(self, item: str, default=None) -> Optional[src.wiki.Wiki]:
|
||||
"""Return a wiki with given domain name"""
|
||||
return self.wikis.get(item, default)
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ class DomainManager:
|
|||
for name, domain in self.domains.items():
|
||||
logger.info("{name} - Status: {status}, exception: {exception}".format(name=name, status=domain.task.done(),
|
||||
exception=domain.task.print_stack()))
|
||||
if self.check_for_domain(self.get_domain(split_payload[1])):
|
||||
logger.info(str(self.return_domain(self.get_domain(split_payload[1])).get_wiki(split_payload[1])))
|
||||
else:
|
||||
raise ValueError("Unknown pub/sub command! Payload: {}".format(payload))
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@ class Statistics:
|
|||
self.last_post: Optional[str] = discussion_id
|
||||
self.logs: LimitedList[Log] = LimitedList()
|
||||
|
||||
def __str__(self):
|
||||
return f"<last_request={self.last_request}, last_checked_rc={self.last_checked_rc}, last_action={last_action}, last_checked_discussion={self.last_checked_discussion}, last_post={last_post}, logs={self.logs}>"
|
||||
|
||||
def update(self, *args: Log, **kwargs: Union[float, int, str]):
|
||||
for key, value in kwargs.items():
|
||||
self.__setattr__(key, value)
|
||||
|
|
|
@ -55,6 +55,14 @@ class Wiki:
|
|||
self.session_requests = requests.Session()
|
||||
self.session_requests.headers.update(settings["header"])
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
f"<statistics={self.statistics} tags={self.tags} first_fetch_done={self.first_fetch_done}, rc_targets={self.rc_targets}, discussion_targets={self.discussion_targets},"
|
||||
f"recache_requested={self.recache_requested}>")
|
||||
|
||||
@property
|
||||
def rc_id(self):
|
||||
return self.statistics.last_action
|
||||
|
|
Loading…
Reference in a new issue