put timestamp on RESTARTING message + 2 others

not on the 'loading module wolfgame' message since that will be removed soon and it helps divide logs anyway
This commit is contained in:
jacob1 2015-01-18 00:10:46 -05:00
parent be6ab9d723
commit 653e881b39
2 changed files with 4 additions and 3 deletions

View File

@ -148,7 +148,7 @@ def connect_callback(cli):
@hook("907") @hook("907")
def on_failure_auth(cli, *etc): def on_failure_auth(cli, *etc):
cli.quit() cli.quit()
print("Authentication failed. Did you fill the account name "+ alog("Authentication failed. Did you fill the account name "+
"in botconfig.USERNAME if it's different from the bot nick?") "in botconfig.USERNAME if it's different from the bot nick?")

View File

@ -39,6 +39,7 @@ from tools import logger
debuglog = logger("debug.log", write=False, display=False) # will be True if in debug mode debuglog = logger("debug.log", write=False, display=False) # will be True if in debug mode
errlog = logger("errors.log") errlog = logger("errors.log")
plog = logger(None) #use this instead of print so that logs have timestamps
BOLD = "\u0002" BOLD = "\u0002"
@ -117,7 +118,7 @@ def connect_callback(cli):
elif signum == SIGUSR1: elif signum == SIGUSR1:
restart_program(cli, "<console>", botconfig.CHANNEL, "") restart_program(cli, "<console>", botconfig.CHANNEL, "")
elif signum == SIGUSR2: elif signum == SIGUSR2:
print("Scheduling aftergame restart") plog("Scheduling aftergame restart")
aftergame(cli, "<console>", "frestart") aftergame(cli, "<console>", "frestart")
signal.signal(signal.SIGINT, sighandler) signal.signal(signal.SIGINT, sighandler)
@ -405,7 +406,7 @@ def restart_program(cli, nick, chan, rest):
cli.quit("Forced restart from "+nick) cli.quit("Forced restart from "+nick)
raise SystemExit raise SystemExit
finally: finally:
print("RESTARTING") plog("RESTARTING")
python = sys.executable python = sys.executable
if rest.strip().lower() == "debugmode": if rest.strip().lower() == "debugmode":
os.execl(python, python, sys.argv[0], "--debug") os.execl(python, python, sys.argv[0], "--debug")