refactor(core): safer and simpler log backend
Description
Refactor the log system to get rid of sightlog
companion process. sightlog
makes the code too complicated and fragile.
Proposal
- Implements a real Boost log backend
- Propose the same level of features as with
sightlog
:- encryption
- compression
- Add "usual" Boost features like log rotation, naming scheme support, etc.
- Remove compile time flags ("SIGHT_ENCRYPTED_LOG" and "SIGHT_DEFAULT_PASSWORD")
- Relocation support
Functional specifications
The API should not change from a user point of view.
Technical specifications
One mistake was to use ZIP instead of "on the fly" single file compression / encryption. This leads us to have an external process to manage correctly crashes and to be sure that the resulting zip file is not corrupted. By using a real Boost log backend, we could compress/encrypt the log stream as a stream, directly to the disk, and we should be able to decompress/decrypt it, even if the file is not correctly closed.
graph TD
A[Sight] -->|log| B(Boost)
B -->|log| C{New Backend}
C -->|log| D(ZSTD)
D -->|compressed log| C
C -->|compressed log| F(OpenSSL)
F -->|encrypted log| C
C -->|encrypted log| E[Disk]
Test plan
- Unit tests
- Manual tests in other applications