Skip to content

Commit

Permalink
Improve logging: remove searching for process log
Browse files Browse the repository at this point in the history
Fix exception logging
  • Loading branch information
aliencaocao committed Aug 5, 2023
1 parent 573731c commit baeb62a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
import gc
import logging
import os
Expand Down Expand Up @@ -172,7 +171,6 @@ def get_song_info(song_id: str) -> SongInfo:


def find_process() -> Tuple[int, str]:
logger.info('Searching for process...')
pythoncom.CoInitialize()
wmic = wmi.WMI()
process_list = wmic.Win32_Process(name='cloudmusic.exe')
Expand Down Expand Up @@ -270,7 +268,8 @@ def update():
logger.info('Reconnecting to Discord...')
connect_discord(RPC)
except Exception as e:
logger.exception('Error while updating Discord:', e)
logger.error('Error while updating to Discord:')
logger.exception(e)
pass

last_id = song_id
Expand All @@ -282,7 +281,8 @@ def update():

gc.collect()
except Exception as e:
logger.exception('Error while updating: ', e)
logger.error('Error while updating song info:')
logger.exception(e)


# calls the update function every second, ignore how long the actual update takes
Expand Down

0 comments on commit baeb62a

Please sign in to comment.