[PR #86] [MERGED] common: Rewrite logging based on cut down citra logger #1279

Closed
opened 2026-02-27 21:11:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/86
Author: @raphaelthegreat
Created: 2/26/2024
Status: Merged
Merged: 2/27/2024
Merged by: @raphaelthegreat

Base: mainHead: new-log


📝 Commits (7)

  • 06a19ac common: Rewrite logging based on cut down Citra logger
  • 29be827 code: Misc fixes
  • 6f96a03 core: Bring back tls handler
  • 6292525 linker: Cleanup
  • 95ca0eb config: Remove log level
  • 8a093ae logging: Enable console output by default
  • a561c58 core: Fix windows build

📊 Changes

70 files changed (+3166 additions, -1495 deletions)

View changed files

📝 .github/workflows/windows.yml (+1 -1)
📝 .gitmodules (+0 -4)
📝 CMakeLists.txt (+28 -6)
📝 src/Util/config.cpp (+8 -6)
📝 src/Util/config.h (+1 -1)
src/common/assert.cpp (+18 -0)
src/common/assert.h (+84 -0)
src/common/bounded_threadsafe_queue.h (+248 -0)
src/common/concepts.h (+31 -0)
src/common/error.cpp (+57 -0)
src/common/error.h (+21 -0)
src/common/fs_file.cpp (+0 -96)
src/common/fs_file.h (+0 -86)
📝 src/common/io_file.cpp (+281 -87)
📝 src/common/io_file.h (+191 -29)
src/common/log.cpp (+0 -159)
src/common/log.h (+0 -42)
src/common/logging/backend.cpp (+277 -0)
src/common/logging/backend.h (+27 -0)
src/common/logging/filter.cpp (+173 -0)

...and 50 more files

📄 Description

Reworks the previous system and introduces a new logger based on citra. From my view this has multiple benefits:

  • Spdlog is no longer needed, thus we get one less dependency which is always a good thing
  • All logging is performed asynchronously by default, so the performance should be impacted minimally
  • The logger is made with the specific needs of an emulator and has been battle tested for many years. The code is also quite small and easy to understand. Thus it's a good base for a new project, as reliable logging can help during development.
  • The previous logger used simple constexpr booleans to turn off logging for various subsystems. This logger supports relatively advanced filters, which allow controlling what gets logged not only globally but per subsystem too. An option for the filter has been added to the config file

I've also imported some additional handy utilities, such as the assertion macros. These are useful for reducing code bloat when checking conditions that should abort the program if they fail, are generally more reliable than normal C asserts and express intent better.

Finally added a small filesystem library based on the excellent filesystem layer yuzu has. It's quite a small subset for now, as the emulator is still quite young and doesn't need much, but these will be very useful for general config and frontend work, filesystem emulation as well (can that be LLEed?). It's a thin wrapper over std::filesystem that does some simple error checking which can be better viewed in the logs and eliminates the exceptions normally thrown by the filesystem API by using error_codes. Other than that, the only other change is that the config file alongside any data shad needs in the future is now stored in a dedicated user folder next to the application, so it can be easily moved in the future.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/86 **Author:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Created:** 2/26/2024 **Status:** ✅ Merged **Merged:** 2/27/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `new-log` --- ### 📝 Commits (7) - [`06a19ac`](https://github.com/shadps4-emu/shadPS4/commit/06a19ac130ece1970da33ba32924bf1c72382bce) common: Rewrite logging based on cut down Citra logger - [`29be827`](https://github.com/shadps4-emu/shadPS4/commit/29be8273d43f1556ba5bf014603862e13a458ffa) code: Misc fixes - [`6f96a03`](https://github.com/shadps4-emu/shadPS4/commit/6f96a03c1328461b330658d86f259ed4a68c53e6) core: Bring back tls handler - [`6292525`](https://github.com/shadps4-emu/shadPS4/commit/6292525fa2d05a0c6f60c244601f89068c090272) linker: Cleanup - [`95ca0eb`](https://github.com/shadps4-emu/shadPS4/commit/95ca0ebdba6459955e09514a2a1fed1f8f105d1f) config: Remove log level - [`8a093ae`](https://github.com/shadps4-emu/shadPS4/commit/8a093aed63f6ea1b5a5dbe3bee0e363979cedd27) logging: Enable console output by default - [`a561c58`](https://github.com/shadps4-emu/shadPS4/commit/a561c58edc665c3b60f10073fc6bd647910b8bbb) core: Fix windows build ### 📊 Changes **70 files changed** (+3166 additions, -1495 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/windows.yml` (+1 -1) 📝 `.gitmodules` (+0 -4) 📝 `CMakeLists.txt` (+28 -6) 📝 `src/Util/config.cpp` (+8 -6) 📝 `src/Util/config.h` (+1 -1) ➕ `src/common/assert.cpp` (+18 -0) ➕ `src/common/assert.h` (+84 -0) ➕ `src/common/bounded_threadsafe_queue.h` (+248 -0) ➕ `src/common/concepts.h` (+31 -0) ➕ `src/common/error.cpp` (+57 -0) ➕ `src/common/error.h` (+21 -0) ➖ `src/common/fs_file.cpp` (+0 -96) ➖ `src/common/fs_file.h` (+0 -86) 📝 `src/common/io_file.cpp` (+281 -87) 📝 `src/common/io_file.h` (+191 -29) ➖ `src/common/log.cpp` (+0 -159) ➖ `src/common/log.h` (+0 -42) ➕ `src/common/logging/backend.cpp` (+277 -0) ➕ `src/common/logging/backend.h` (+27 -0) ➕ `src/common/logging/filter.cpp` (+173 -0) _...and 50 more files_ </details> ### 📄 Description Reworks the previous system and introduces a new logger based on citra. From my view this has multiple benefits: * Spdlog is no longer needed, thus we get one less dependency which is always a good thing * All logging is performed asynchronously by default, so the performance should be impacted minimally * The logger is made with the specific needs of an emulator and has been battle tested for many years. The code is also quite small and easy to understand. Thus it's a good base for a new project, as reliable logging can help during development. * The previous logger used simple constexpr booleans to turn off logging for various subsystems. This logger supports relatively advanced filters, which allow controlling what gets logged not only globally but per subsystem too. An option for the filter has been added to the config file I've also imported some additional handy utilities, such as the assertion macros. These are useful for reducing code bloat when checking conditions that should abort the program if they fail, are generally more reliable than normal C asserts and express intent better. Finally added a small filesystem library based on the excellent filesystem layer yuzu has. It's quite a small subset for now, as the emulator is still quite young and doesn't need much, but these will be very useful for general config and frontend work, filesystem emulation as well (can that be LLEed?). It's a thin wrapper over std::filesystem that does some simple error checking which can be better viewed in the logs and eliminates the exceptions normally thrown by the filesystem API by using error_codes. Other than that, the only other change is that the config file alongside any data shad needs in the future is now stored in a dedicated user folder next to the application, so it can be easily moved in the future. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:11:54 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1279
No description provided.