Skip to content

Commit

Permalink
Resolved logging issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wittiness committed Jul 28, 2023
1 parent b25da29 commit f364746
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pymino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__author__ = 'cynical'
__license__ = 'MIT'
__copyright__ = 'Copyright 2023 Cynical'
__version__ = '1.2.4.5'
__version__ = '1.2.4.6'
__description__ = 'A Python wrapper for the aminoapps.com API'

from .bot import Bot
Expand Down
2 changes: 1 addition & 1 deletion pymino/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def _run(self, response: dict) -> dict:
cache_login(email=self.request.email, device=self.device_id, sid=self.sid)

if self.debug:
print(f"{Fore.MAGENTA}Logged in as {self.profile.username.encode()} ({self.profile.userId}){Style.RESET_ALL}")
print(f"{Fore.MAGENTA}Logged in as {self.profile.username} ({self.profile.userId}){Style.RESET_ALL}")

return response

Expand Down
6 changes: 3 additions & 3 deletions pymino/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,13 +822,13 @@ def _run(self, response: dict) -> dict:
if not self.is_ready:
self._is_ready = True
self._is_authenticated = True
self._log(f"Logged in as {self.profile.username.encode()} ({self.profile.userId})")
self._log(f"Logged in as {self.profile.username} ({self.profile.userId})")
self.connect()
else:
self._log(f"Reconnected as {self.profile.username.encode()} ({self.profile.userId})")
self._log(f"Reconnected as {self.profile.username} ({self.profile.userId})")

if self.debug:
print(f"{Fore.MAGENTA}Logged in as {self.profile.username.encode()} ({self.profile.userId}){Style.RESET_ALL}")
print(f"{Fore.MAGENTA}Logged in as {self.profile.username} ({self.profile.userId}){Style.RESET_ALL}")

Thread(target=self.__run_console__).start()
return response
Expand Down
8 changes: 4 additions & 4 deletions pymino/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def _log(self, message: str) -> None:
"""
if self.is_logging:
try:
self.logger.debug(message)
self.logger.debug(message.encode("utf-8"))
except Exception:
self.is_logging = False

Expand Down Expand Up @@ -727,12 +727,12 @@ def _run(self, response: dict) -> dict:

if not self.is_authenticated:
self._is_authenticated = True
self._log(f"Logged in as {self.profile.username.encode()} ({self.profile.userId})")
self._log(f"Logged in as {self.profile.username} ({self.profile.userId})")
else:
self._log(f"Reconnected as {self.profile.username.encode()} ({self.profile.userId})")
self._log(f"Reconnected as {self.profile.username} ({self.profile.userId})")

if self.debug:
print(f"{Fore.MAGENTA}Logged in as {self.profile.username.encode()} ({self.profile.userId}){Style.RESET_ALL}")
print(f"{Fore.MAGENTA}Logged in as {self.profile.username} ({self.profile.userId}){Style.RESET_ALL}")

return response

Expand Down
2 changes: 1 addition & 1 deletion pymino/ext/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _log(self, message: str) -> None:
"""
if self.is_logging:
try:
self.logger.debug(message)
self.logger.debug(message.encode("utf-8"))
except Exception:
self.is_logging = False

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pymino
version = 1.2.4.5
version = 1.2.4.6
author = forevercynical
author_email = me@cynical.gg
description = Easily create a bot for Amino Apps using a modern easy to use synchronous library.
Expand Down

0 comments on commit f364746

Please sign in to comment.