-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevlog.rpy
More file actions
38 lines (29 loc) · 1.2 KB
/
devlog.rpy
File metadata and controls
38 lines (29 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
init -100 python:
import os
import sys
import logging
# absolute path to the game directory, which is formatted according
# to the conventions of the local OS
gamedir = os.path.normpath(config.gamedir)
# required to make the above work with with RenPy:
config.reject_backslash = False
# setting the window on center
# useful if game is launched in the window mode
os.environ['SDL_VIDEO_CENTERED'] = '1'
sys.setdefaultencoding('utf-8')
# Game may bug out on saving, in such case, comment should be removed
# config.use_cpickle = False
# enable logging via the 'logging' module
format='%(levelname)-8s%(message)s'
logging.basicConfig(level=logging.DEBUG, format=format)
devlog = logging.getLogger(" ".join([config.name, config.version]))
devlogfile = logging.FileHandler(os.path.join(gamedir, "devlog.txt"))
devlogfile.setLevel(logging.DEBUG)
devlog.addHandler(devlogfile)
devlog.critical("\n--- launch ---")
fm = logging.Formatter(format)
devlogfile.setFormatter(fm)
del fm
devlog.info("Game directory: %s" % gamedir)
devlog = logging.getLogger(" ".join([config.name, config.version]))
_editor.devlog = devlog