parent
efab8928f5
commit
6faadd6669
@ -84,7 +84,10 @@ port = 64738
|
|||||||
#pip3_path = venv/bin/pip
|
#pip3_path = venv/bin/pip
|
||||||
|
|
||||||
# 'logfile': write logs into this file.
|
# 'logfile': write logs into this file.
|
||||||
|
# 'redirect_strerr': capture outputs from stderr and write into the `logfile`,
|
||||||
|
# useful for capture the exception message when the bot crash.
|
||||||
#logfile =
|
#logfile =
|
||||||
|
#redirect_strerr = False
|
||||||
|
|
||||||
#announce_current_music = True
|
#announce_current_music = True
|
||||||
#allow_other_channel_message = False
|
#allow_other_channel_message = False
|
||||||
|
@ -802,8 +802,9 @@ if __name__ == '__main__':
|
|||||||
if logfile:
|
if logfile:
|
||||||
print(f"Redirecting stdout and stderr to log file: {logfile}")
|
print(f"Redirecting stdout and stderr to log file: {logfile}")
|
||||||
handler = logging.handlers.RotatingFileHandler(logfile, mode='a', maxBytes=10240) # Rotate after 10KB
|
handler = logging.handlers.RotatingFileHandler(logfile, mode='a', maxBytes=10240) # Rotate after 10KB
|
||||||
sys.stdout = util.LoggerIOWrapper(bot_logger, logging.INFO, fallback_io_buffer=sys.stdout.buffer)
|
if var.config.getboolean("bot", "redirect_stderr", fallback=False):
|
||||||
sys.stderr = util.LoggerIOWrapper(bot_logger, logging.INFO, fallback_io_buffer=sys.stderr.buffer)
|
sys.stderr = util.LoggerIOWrapper(bot_logger, logging.INFO,
|
||||||
|
fallback_io_buffer=sys.stderr.buffer)
|
||||||
else:
|
else:
|
||||||
handler = logging.StreamHandler()
|
handler = logging.StreamHandler()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user