Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear config.log file during game startup #5286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions renpy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@
# A logfile that logging messages are sent to.
log = None

# Clear config.log at startup
clear_log = False

# Lint hooks.
lint_hooks = [ ]

Expand Down
7 changes: 6 additions & 1 deletion renpy/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,12 @@ def log(msg):
try:

if not logfile:
logfile = open(os.path.join(renpy.config.basedir, renpy.config.log), "a")
import os
if renpy.config.clear_log:
file_mode = "w"
else:
file_mode = "a"
logfile = open(os.path.join(renpy.config.basedir, renpy.config.log), file_mode)

if not logfile.tell():
logfile.write("\ufeff")
Expand Down