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 #5267

Open
lent1-andrealphusgames opened this issue Jan 15, 2024 · 0 comments
Open

Clear config.log file during game startup #5267

lent1-andrealphusgames opened this issue Jan 15, 2024 · 0 comments

Comments

@lent1-andrealphusgames
Copy link

When config.log is defined, this file is opened in append mode.
The log file will grow endlessly if not manually cleared/deleted.

It would be great if you can add a config variable to open the file in write mode.
It should wipe the content of the log file each time the game starts

I'm thinking of something like that:
in config.rpy

# A logfile that logging messages are sent to.
log = None

# Clear config.log at startup
clear_log = False

and in export.py

if not logfile:
    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)

So we can change the filemode through options.rpy with something like this:

define config.log = "game.log"
define config.clear_log = True

If that's not relevant, I'll continue to manually delete the log file.

Thanks

@lent1-andrealphusgames lent1-andrealphusgames changed the title Clear config.log file when starting a game Clear config.log file during game startup Jan 15, 2024
@renpytom renpytom added this to the 8.3 / 7.8 Prerelease milestone Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants