Skip to content

Commit

Permalink
logging tidying and lang updates
Browse files Browse the repository at this point in the history
  • Loading branch information
efroemling committed Nov 8, 2024
1 parent e6891e7 commit 9fa5b8d
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 40 deletions.
70 changes: 35 additions & 35 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 22080, api 9, 2024-11-07)
### 1.7.37 (build 22082, 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
2 changes: 1 addition & 1 deletion 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 = 22080
TARGET_BALLISTICA_BUILD = 22082
TARGET_BALLISTICA_VERSION = '1.7.37'


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 = 22080;
const int kEngineBuildNumber = 22082;
const char* kEngineVersion = "1.7.37";
const int kEngineApiVersion = 9;

Expand Down
1 change: 1 addition & 0 deletions src/ballistica/shared/foundation/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void Logging::EmitLog(const std::string& name, LogLevel level, double timestamp,
break;
}
char prestr[256];

snprintf(prestr, sizeof(prestr), "%.3f %s", rel_time, name.c_str());
g_base_soft->PushDevConsolePrintCall("", 0.3f, kVector4f1);
g_base_soft->PushDevConsolePrintCall(
Expand Down
17 changes: 15 additions & 2 deletions tools/efro/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from threading import Thread, current_thread, Lock

from efro.util import utc_now
from efro.terminal import Clr
from efro.terminal import Clr, color_enabled
from efro.dataclassio import ioprepped, IOAttrs, dataclass_to_json

if TYPE_CHECKING:
Expand Down Expand Up @@ -312,6 +312,7 @@ def call_in_thread(self, call: Callable[[], Any]) -> None:
@override
def emit(self, record: logging.LogRecord) -> None:
# pylint: disable=too-many-branches
# pylint: disable=too-many-locals

if __debug__:
starttime = time.monotonic()
Expand Down Expand Up @@ -369,7 +370,19 @@ def emit(self, record: logging.LogRecord) -> None:
).strftime('%H:%M:%S')
+ f'.{int(record.msecs):03d}'
)
preinfo = f'{Clr.WHT}{timestamp} {record.name}:{Clr.RST} '

# If color printing is disabled, show level through text
# instead of color.
lvlnameex = (
''
if color_enabled
else f' {logging.getLevelName(record.levelno)}'
)

preinfo = (
f'{Clr.WHT}{timestamp} {record.name}{lvlnameex}:'
f'{Clr.RST} '
)
ends = LEVELNO_COLOR_CODES.get(record.levelno)
if ends is not None:
self._echofile.write(f'{preinfo}{ends[0]}{msg}{ends[1]}\n')
Expand Down

0 comments on commit 9fa5b8d

Please sign in to comment.