Add an additional CALL logging level
This commit is contained in:
1 parent
91917c2e6d
commit
b6bc2e11cf
3 files changed
+41
-34
No files matched your search
@@ -29,7 +29,7 @@ if __name__ == "__main__":
|
|||||||
from utils import resource_path
|
from utils import resource_path
|
||||||
from version import __version__
|
from version import __version__
|
||||||
from exceptions import CaptchaRequired
|
from exceptions import CaptchaRequired
|
||||||
from constants import SELF_PATH, FILE_FORMATTER, LOG_PATH, WINDOW_TITLE
|
from constants import CALL, SELF_PATH, FILE_FORMATTER, LOG_PATH, WINDOW_TITLE
|
||||||
|
|
||||||
class Parser(argparse.ArgumentParser):
|
class Parser(argparse.ArgumentParser):
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
@@ -61,7 +61,8 @@ if __name__ == "__main__":
|
|||||||
0: logging.ERROR,
|
0: logging.ERROR,
|
||||||
1: logging.WARNING,
|
1: logging.WARNING,
|
||||||
2: logging.INFO,
|
2: logging.INFO,
|
||||||
3: logging.DEBUG,
|
3: CALL,
|
||||||
|
4: logging.DEBUG,
|
||||||
}[min(self._verbose, 3)]
|
}[min(self._verbose, 3)]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ Available command line arguments:
|
|||||||
• --tray
|
• --tray
|
||||||
Start application as minimised into tray.
|
Start application as minimised into tray.
|
||||||
• -v
|
• -v
|
||||||
Increase verbosity level. Can be stacked up to 3 times (-vv and -vvv) to show
|
Increase verbosity level. Can be stacked up several times (-vv, -vvv, etc.) to show
|
||||||
increasingly more information during application runtime.
|
increasingly more information during application runtime.
|
||||||
• --log
|
• --log
|
||||||
Enables logging of runtime information into a 'log.txt' file. Verbosity level of this logging
|
Enables logging of runtime information into a 'log.txt' file. Verbosity level of this logging
|
||||||
|
|||||||
@@ -1157,39 +1157,45 @@ class Twitch:
|
|||||||
|
|
||||||
NOTE: 'stream_before' gets dealocated once this function finishes.
|
NOTE: 'stream_before' gets dealocated once this function finishes.
|
||||||
"""
|
"""
|
||||||
if stream_before is None and stream_after is not None:
|
if stream_before is None:
|
||||||
# Channel going ONLINE
|
if stream_after is not None:
|
||||||
logger.info(f"{channel.name} goes ONLINE")
|
# Channel going ONLINE
|
||||||
# continue to below
|
if (
|
||||||
elif stream_before is not None and stream_after is None:
|
self.can_watch(channel) # we can watch the channel
|
||||||
# Channel going OFFLINE
|
and self.should_switch(channel) # and we should!
|
||||||
# Change the channel if we're currently watching it
|
):
|
||||||
watching_channel = self.watching_channel.get_with_default(None)
|
self.watch(channel)
|
||||||
if watching_channel is not None and watching_channel == channel:
|
self.print(_("status", "goes_online").format(channel=channel.name))
|
||||||
self.print(_("status", "goes_offline").format(channel=channel.name))
|
self.gui.status.update(
|
||||||
self.change_state(State.CHANNEL_SWITCH)
|
_("gui", "status", "watching").format(channel=channel.name)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.info(f"{channel.name} goes ONLINE")
|
||||||
else:
|
else:
|
||||||
logger.info(f"{channel.name} goes OFFLINE")
|
# Channel was OFFLINE and stays that way
|
||||||
channel.display()
|
# Nothing to do here for now
|
||||||
return
|
return
|
||||||
elif stream_after is not None and stream_after is not None:
|
|
||||||
# Channel is and stays ONLINE, but has been updated
|
|
||||||
logger.info(f"{channel.name} status has been updated")
|
|
||||||
# continue to below
|
|
||||||
else:
|
else:
|
||||||
# Channel was OFFLINE and stays that way
|
watching_channel = self.watching_channel.get_with_default(None)
|
||||||
# Nothing to do here for now
|
if (
|
||||||
return
|
watching_channel is not None
|
||||||
|
and watching_channel == channel
|
||||||
if (
|
and not self.can_watch(channel)
|
||||||
self.can_watch(channel) # we can watch the channel
|
):
|
||||||
and self.should_switch(channel) # and we should!
|
if stream_after is None:
|
||||||
):
|
# Channel going OFFLINE
|
||||||
self.watch(channel)
|
self.print(_("status", "goes_offline").format(channel=channel.name))
|
||||||
self.print(_("status", "goes_online").format(channel=channel.name))
|
# if the channel stays online, we silently trigger a switch
|
||||||
self.gui.status.update(
|
self.change_state(State.CHANNEL_SWITCH)
|
||||||
_("gui", "status", "watching").format(channel=channel.name)
|
elif stream_after is None:
|
||||||
)
|
logger.info(f"{channel.name} goes OFFLINE")
|
||||||
|
else:
|
||||||
|
# Channel is and stays ONLINE, but has been updated
|
||||||
|
logger.info(
|
||||||
|
f"{channel.name} status has been updated "
|
||||||
|
f"(🎁: {stream_before.drops_enabled and '✔' or '❌'} -> "
|
||||||
|
f"{stream_after.drops_enabled and '✔' or '❌'})"
|
||||||
|
)
|
||||||
channel.display()
|
channel.display()
|
||||||
|
|
||||||
@task_wrapper
|
@task_wrapper
|
||||||
|
|||||||
Reference in new issue
Block a user