Made logger more advanced.
All checks were successful
Build Ragnar anti spam bot / Build (push) Successful in 1m13s

This commit is contained in:
retoor 2024-12-17 13:03:41 +01:00
parent 0f4b8b7079
commit c0b0f31f41
2 changed files with 6 additions and 5 deletions

View File

@ -1,11 +1,16 @@
import logging
import sys
file_handler = logging.FileHandler('ragnar.log')
file_handler.setLevel(logging.INFO)
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[
logging.StreamHandler(sys.stdout),
file_handler
],
)

View File

@ -28,13 +28,9 @@ def bot_task(username, password):
try:
bot.fight()
except Exception as ex:
print(ex)
with pathlib.Path("errors.log").open("a+") as f:
f.write(str(ex))
f.write("\n")
log.critical(ex, exc_info=True)
break
def main():
args = parse_args()
usernames = [