Skip to content

Commit

Permalink
Merge pull request #15 from HadManySons/fix_linting
Browse files Browse the repository at this point in the history
Fix linting
  • Loading branch information
HadManySons authored Mar 9, 2024
2 parents 7e564fc + 2fa9bda commit 41a6c71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/pylint.yml

This file was deleted.

4 changes: 2 additions & 2 deletions AFILinkerBot/AFILinkerBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
def checkForReplies(comment_list, rAirForceComments):
for comment in comment_list:
if rAirForceComments.id in comment.body:
print_and_log("Already processed comment: " + permlink + ", skipping")
return True
print_and_log("Already processed comment: " + permlink + ", skipping")
return True
return False

#Try to login or sleep/wait until logged in, or exit if user/pass wrong
Expand Down
10 changes: 7 additions & 3 deletions AFILinkerBot/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,33 @@
import logging
from logging.handlers import RotatingFileHandler

"""Some helping functions for the main script"""

LOG_TIME_FORMAT = "%Y/%m/%d %H:%M:%S "

logger = logging.getLogger("AFILinkerBot Rotating Log")
logger.setLevel(logging.INFO)

# add a rotating handler
handler = RotatingFileHandler("AFILinkerBot.log", maxBytes=2048000, backupCount=25)
logger.addHandler(handler)

logger404 = logging.getLogger("AFILinkerBot 404 error Rotating Log")
logger404.setLevel(logging.INFO)

# add a rotating handler
handler404 = RotatingFileHandler("404errors.log", maxBytes=2048000, backupCount=25)
logger404.addHandler(handler)

"""prints and logs at the same time"""
def print_and_log(text, error=False):
print(text)
if error:
logger.error(time.strftime(LOG_TIME_FORMAT) + text)
else:
logger.info(time.strftime(LOG_TIME_FORMAT) + text)

"""logs 404 errors that come from the epubs site"""
def log404(text):
print(text)
logger404.info(time.strftime(LOG_TIME_FORMAT) + text)
logger404.info(time.strftime(LOG_TIME_FORMAT) + text)

0 comments on commit 41a6c71

Please sign in to comment.