feat/refactor: bemanitools core, logger, thread #282

Open
icex2 wants to merge 41 commits from icex2/logger-refactoring into development
icex2 commented 2024-02-04 16:29:56 +03:00 (Migrated from github.com)

Recommendation to reviewer(s): Review by commit, I added further details and reasoning and tried my best to scope slice and scope the changes.

The main goal of the entire changeset is to refactor two "core" APIs/modules in bemanitools, thread and log(ger). This is, more or less, simply done by moving it out of utils and into a new package named "core".
But, the changes furthermore address several issues and limitations that bemanitools has experienced over the last years.

Copy-paste from the "key commit" that adds the new core module with thread and log:

This module contains the "core" (API) of
bemanitools which includes an abstraction
layer for threads and logging at this time.

The threads API is very close to what
util/thread already was with some structural
enhancements which make it easier to understand
and work with the API, I hope. Some additional
helpers (*-ext module) support in doing common
tasks, e.g. setting up the thread API with other
modules.

The log(ging) part receives a major overhaul to
address known limitations and issues with the
util/log module:

  • Cleaner API layer
  • Separate sinks from actual logging engine
  • Sinks are composable
  • Improved and cleaner compatibility layer
    with AVS logging API

Additional "extensions" (*-ext modules) add
various helper functions for common tasks like
setting up the logging engine with a file and stdout
sink.

The sinks also improved significantly with the file
sink now supporting proper appending and log rotation.
Logging to stdout/stderr supports coloring of log
messages which works across logging engines.

Overall, this refactored foundation is expected to
support future developments and removes known
limitations at the current scale of bemanitools such as:

  • Reducing boiler plate code across hooks
  • Interop of bemanitools and AVS (and setting the foundation
    for addressing currently missing interop, e.g. for
    dealing with property structures without AVS)
  • Addressing performance issues in the logging engine
    due to incorrect interop with AVS
Recommendation to reviewer(s): Review by commit, I added further details and reasoning and tried my best to scope slice and scope the changes. The main goal of the entire changeset is to refactor two "core" APIs/modules in bemanitools, thread and log(ger). This is, more or less, simply done by moving it out of utils and into a new package named "core". But, the changes furthermore address several issues and limitations that bemanitools has experienced over the last years. Copy-paste from the "key commit" that adds the new core module with thread and log: This module contains the "core" (API) of bemanitools which includes an abstraction layer for threads and logging at this time. The threads API is very close to what util/thread already was with some structural enhancements which make it easier to understand and work with the API, I hope. Some additional helpers (*-ext module) support in doing common tasks, e.g. setting up the thread API with other modules. The log(ging) part receives a major overhaul to address known limitations and issues with the util/log module: - Cleaner API layer - Separate sinks from actual logging engine - Sinks are composable - Improved and cleaner compatibility layer with AVS logging API Additional "extensions" (*-ext modules) add various helper functions for common tasks like setting up the logging engine with a file and stdout sink. The sinks also improved significantly with the file sink now supporting proper appending and log rotation. Logging to stdout/stderr supports coloring of log messages which works across logging engines. Overall, this refactored foundation is expected to support future developments and removes known limitations at the current scale of bemanitools such as: - Reducing boiler plate code across hooks - Interop of bemanitools and AVS (and setting the foundation for addressing currently missing interop, e.g. for dealing with property structures without AVS) - Addressing performance issues in the logging engine due to incorrect interop with AVS
This pull request has changes conflicting with the target branch.
  • Module.mk
  • README.md
  • dist/ddr/gamestart-17.bat
  • dist/ddr/gamestart-18.bat
  • doc/ddrhook/ddrhook2.md
  • src/imports/import_32_1306_avs.def
  • src/imports/import_32_1403_avs.def
  • src/imports/import_64_1603_avs.def
  • src/main/avs-util/Module.mk
  • src/main/avs-util/error.c
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin icex2/logger-refactoring:icex2/logger-refactoring
git checkout icex2/logger-refactoring
Sign in to join this conversation.