logging formatting

This commit is contained in:
Nicolás Sánchez 2025-01-17 20:17:31 -03:00
parent 4ed36e1482
commit 15b2cf5601
1 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ class earner:
def write_to_log(self,message):
with open("earn.log", "a") as f:
f.write(str(self.connector) + datetime.datetime.now().strftime(' [%Y/%m/%d %H:%M:%S] ') + message + "\n")
f.write(datetime.datetime.now().strftime(f"[%Y/%m/%d %H:%M:%S] {str(self.connector).upper()} | {message}\n"))
def toggle_pause(self):
self.is_paused = not self.is_paused
@ -121,7 +121,7 @@ class earner:
def subscribe(self,amount,force_pause=False):
print(f"{datetime.datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')} | {str(self.connector).upper()} | Subscribing {amount} {self.currency}")
print(f"{datetime.datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')} | {str(self.connector).upper()} | {colors.green}Subscribing{colors.white} {amount} {self.currency}")
self.write_to_log(f"{colors.green}Subscribing{colors.white} {amount} {self.currency}")
if force_pause:
@ -157,7 +157,7 @@ class earner:
return 1
def redeem(self,amount,force_pause=False):
print(f"{datetime.datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')} | {str(self.connector).upper()} | Redeeming {amount} {self.currency}")
print(f"{datetime.datetime.now().strftime('[%Y/%m/%d %H:%M:%S]')} | {str(self.connector).upper()} | {colors.red}Redeeming{colors.white} {amount} {self.currency}")
self.write_to_log(f"{colors.red}Redeeming{colors.white} {amount} {self.currency}")
if force_pause: