Skip to content

Commit

Permalink
wiring up server logging controls
Browse files Browse the repository at this point in the history
  • Loading branch information
efroemling committed Nov 8, 2024
1 parent a97119b commit e6891e7
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 56 deletions.
88 changes: 44 additions & 44 deletions .efrocachemap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### 1.7.37 (build 22077, api 9, 2024-11-07)
### 1.7.37 (build 22080, api 9, 2024-11-07)
- Bumping api version to 9. As you'll see below, there's some UI changes that
will require a bit of work for any UI mods to adapt to. If your mods don't
touch UI stuff at all you can simply bump your api version and call it a day.
Expand Down
6 changes: 4 additions & 2 deletions src/assets/ba_data/python/baenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 22077
TARGET_BALLISTICA_BUILD = 22080
TARGET_BALLISTICA_VERSION = '1.7.37'


Expand Down Expand Up @@ -316,7 +316,7 @@ def _setup_logging(launch_time: float) -> LogHandler:

log_handler = setup_logging(
log_path=None,
level=LogLevel.DEBUG,
level=LogLevel.INFO,
log_stdout_stderr=True,
cache_size_limit=1024 * 1024,
launch_time=launch_time,
Expand All @@ -336,6 +336,8 @@ def _set_log_levels(app_config: dict) -> None:
get_base_logger_control_config_client().apply()
return

print('WTF', config)

# Make sure data is expected types/values.
valid_levels = {
logging.NOTSET,
Expand Down
38 changes: 31 additions & 7 deletions src/assets/server_package/ballisticakit_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import json
import signal
import tomllib
import logging
import subprocess
from pathlib import Path
from threading import Lock, Thread, current_thread
Expand Down Expand Up @@ -801,23 +802,46 @@ def _prep_subprocess_environment(self) -> None:

# Some of our config values translate directly into the
# ballisticakit config file; the rest we pass at runtime.

# IMPORTANT: Make sure we *ALWAYS* push values (or lack thereof)
# through; otherwise stale values from previous runs can linger
# in the bincfg.

bincfg['Port'] = self._config.port
bincfg['Auto Balance Teams'] = self._config.auto_balance_teams
bincfg['Show Tutorial'] = self._config.show_tutorial

binkey = 'SceneV1 Host Protocol'
if self._config.protocol_version is not None:
bincfg['SceneV1 Host Protocol'] = self._config.protocol_version
bincfg[binkey] = self._config.protocol_version
elif binkey in bincfg:
del bincfg[binkey]

binkey = 'Custom Team Names'
if self._config.team_names is not None:
bincfg['Custom Team Names'] = self._config.team_names
elif 'Custom Team Names' in bincfg:
del bincfg['Custom Team Names']
bincfg[binkey] = self._config.team_names
elif binkey in bincfg:
del bincfg[binkey]

binkey = 'Custom Team Colors'
if self._config.team_colors is not None:
bincfg['Custom Team Colors'] = self._config.team_colors
elif 'Custom Team Colors' in bincfg:
del bincfg['Custom Team Colors']
bincfg[binkey] = self._config.team_colors
elif binkey in bincfg:
del bincfg[binkey]

bincfg['Idle Exit Minutes'] = self._config.idle_exit_minutes

binkey = 'Log Levels'
if self._config.log_levels is not None:
# Users supply us log level names like NOTSET; convert those
# to numeric vals which the engine expects.
bincfg[binkey] = {
key: logging.getLevelName(val)
for key, val in self._config.log_levels.items()
}
elif binkey in bincfg:
del bincfg[binkey]

with open(cfgpath, 'w', encoding='utf-8') as outfile:
outfile.write(json.dumps(bincfg))

Expand Down
2 changes: 1 addition & 1 deletion src/ballistica/shared/ballistica.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {

// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 22077;
const int kEngineBuildNumber = 22080;
const char* kEngineVersion = "1.7.37";
const int kEngineApiVersion = 9;

Expand Down
2 changes: 1 addition & 1 deletion tools/batools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def _get_server_config_template_toml(projroot: str) -> str:
cfg.team_colors = ((0.1, 0.25, 1.0), (1.0, 0.25, 0.2))
cfg.public_ipv4_address = '123.123.123.123'
cfg.public_ipv6_address = '123A::A123:23A1:A312:12A3:A213:2A13'
cfg.log_levels = {'ba.lifecycle': 'DEBUG', 'ba.assets': 'DEBUG'}
cfg.log_levels = {'ba.lifecycle': 'DEBUG', 'ba.assets': 'INFO'}

lines_in = _get_server_config_raw_contents(projroot).splitlines()

Expand Down

0 comments on commit e6891e7

Please sign in to comment.