Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions docs/design_decisions/explicit_init.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Explicit initialization of logging
==================================

.. dec_rec:: Explicit initialization of logging
:id: dec_rec__log__explicit_init
:status: proposed
:context: See below.
:decision: TBA

Provide a library for explicit initialization of logging.

**Context:**

Currently there are multiple approaches to logging initialization.
Rust frontend configuration is provided as code and requires explicit initialization before any logging starts.
C++ configuration is lazily loaded on first use and based on a JSON file with path provided using environment variable.

This approach discrepancy makes it difficult to manage logging in multi-language environment.
Issue can be solved by providing an explicit initialization library.

Such explicit logging initialization shall:

- Initialize logging for Rust and C++ environments.
- Handle configuration of all sub-components of the logging environment.
- Provide interfaces to Rust and C++.

Examples of use:

- Initialize logging in Rust application:
- Rust logging frontend
- C++-based backend
- Rust/C++ log bridge
- Initialize logging in C++ application utilizing Rust-based libraries:
- C++ logging
- Rust logging frontend utilized by libraries
- C++-based backend
- Rust/C++ log bridge

**Consequences**

Such change will require design changes to middleware logging.

In Rust it is a common practice to explicitly initialize logging before any logging starts.
This is true to both `score_log` logging frontend and ubiquitous `log` crate that is a defacto standard for logging in Rust.

Middleware logging library is currently initialized lazily on first use, using JSON config file.
It is not possible to perform the initialization operation explicitly.

**Justification for the Decision**

Explicit logging initialization will simplify logging initialization in multi-language environments.
11 changes: 11 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@ Example:
}

This enables conditional behavior (e.g., choosing `clang-tidy` for C++ or `clippy` for Rust).

Decision records
----------------

.. TODO: move decision records to proper location once docs are made.

.. toctree::
:maxdepth: 1
:glob:

design_decisions/explicit_init.rst
Loading