Made logger more advanced.
All checks were successful
Build Ragnar anti spam bot / Build (push) Successful in 1m13s
All checks were successful
Build Ragnar anti spam bot / Build (push) Successful in 1m13s
This commit is contained in:
parent
0f4b8b7079
commit
c0b0f31f41
@ -1,11 +1,16 @@
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
file_handler = logging.FileHandler('ragnar.log')
|
||||||
|
file_handler.setLevel(logging.INFO)
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||||
handlers=[
|
handlers=[
|
||||||
logging.StreamHandler(sys.stdout),
|
logging.StreamHandler(sys.stdout),
|
||||||
|
file_handler
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,13 +28,9 @@ def bot_task(username, password):
|
|||||||
try:
|
try:
|
||||||
bot.fight()
|
bot.fight()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print(ex)
|
log.critical(ex, exc_info=True)
|
||||||
with pathlib.Path("errors.log").open("a+") as f:
|
|
||||||
f.write(str(ex))
|
|
||||||
f.write("\n")
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
usernames = [
|
usernames = [
|
||||||
|
Loading…
Reference in New Issue
Block a user