aboutsummaryrefslogtreecommitdiff
path: root/src/common/logging/backend.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-369/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [common] remove uneeded allocations in logs (#3409)lizzie2026-02-051-54/+60
| | | | | | | | | | | | | | + make filename be a const char also mark as `noexcept` to avoid emission of uneeded unwind paths :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3409 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [logging] disable windows-only debugger backend on non-windows platforms (#3032)lizzie2025-12-011-41/+25
| | | | | | | | | | Signed-off-by: lizzie lizzie@eden-emu.dev Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3032 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [logging] USER null fallback (#3021)crueter2025-11-171-4/+14
| | | | | | | | | If `USER` was unset, logging would crash immediately. `USER` is *not* a guaranteed variable, so to get around this we add a null fallback and also prefer `LOGNAME`, which is "standard" on POSIX systems (yet half the time isn't set because fuck me I guess) Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3021 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Maufeat <sahyno1996@gmail.com>
* [logging, debugger] remove unescesary logic and only query USER env variable ↵lizzie2025-10-271-37/+25
| | | | | | | | | | | | | once (#2800) - censoring an username would lead to the variable being queried everytime something is written, just store it on a static - dont use a map<> for something that can be done in a switch statment (and that the compiler will optimise for free!!!) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2800 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [common/logging] faster logging by avoiding constructing unused ↵lizzie2025-10-011-16/+22
| | | | | | | | | | | | | | strings/results (and filtering first) (#2603) basically std::string would be invoked even when the logging was filtered, then destroyed instantly, invoking malloc/free and polluting mem arenas for no good reason Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2603 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [debug] Rename remaining names in accordance with PR 341 (#343)MaranBr2025-08-281-1/+4
| | | | | | | | | This renames the remaining names in accordance with PR 341. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/343 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: MaranBr <maranbr@outlook.com> Co-committed-by: MaranBr <maranbr@outlook.com>
* add option to censor the username in logs (#111)Aleksandr Popovich2025-05-191-2/+16
| | | | | | | | Signed-off-by: Aleksandr Popovich <alekpopo@pm.me> Co-authored-by: Esther1024 <danishreyjavik@outlook.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/111 Co-authored-by: Aleksandr Popovich <alekpopo@pm.me> Co-committed-by: Aleksandr Popovich <alekpopo@pm.me>
* User Data Migration from Citron, Sudachi, and Yuzu (#91)swurl2025-05-081-1/+1
| | | | | | | | | | | | Includes citron, sudachi, yuzu currently broken, because the eden dir is always made early? Signed-off-by: swurl <swurl@swurl.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/91 Co-authored-by: swurl <swurl@swurl.xyz> Co-committed-by: swurl <swurl@swurl.xyz>
* Runtime option for flushing logs by line (#90)swurl2025-05-081-6/+6
| | | | | | | Signed-off-by: swurl <swurl@swurl.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/90 Co-authored-by: swurl <swurl@swurl.xyz> Co-committed-by: swurl <swurl@swurl.xyz>
* Log by line compilation optionswurl2025-04-241-0/+5
| | | | Signed-off-by: swurl <swurl@swurl.xyz>
* Update fmt to allow for v11crueter2025-04-101-1/+1
| | | Signed-off-by: swurl <swurl@swurl.xyz>
* Port changes from Early Accessdarktux2025-04-041-1/+1
|
* assert/logging: Stop the logging thread and flush the backends before crashingFearlessTobi2023-12-261-0/+17
| | | | Co-Authored-By: SachinVin <26602104+SachinVin@users.noreply.github.com>
* backend: Remove usage of explicit operator overloadlat9nq2023-07-251-1/+1
| | | | | | Causes a crash on MSVC from a race condition on application quit. Intended to address yuzu-emu/yuzu/issues/11137
* common: logging: Implement Android logcat backend.bunnei2023-06-031-0/+26
|
* bounded_threadsafe_queue: Deduplicate and add PushModesMorph2023-03-211-1/+1
| | | | | | | Adds the PushModes Try and Wait to allow producers to specify how they want to push their data to the queue if the queue is full. If the queue is full: - Try will fail to push to the queue, returning false. Try only returns true if it successfully pushes to the queue. This may result in items not being pushed into the queue. - Wait will wait until a slot is available to push to the queue, resulting in potential for deadlock if a consumer is not running.
* logging: Make use of bounded queueMorph2023-03-211-8/+8
|
* general: fix compile for Apple ClangLiam2022-11-221-1/+1
|
* common: remove "yuzu:" prefix from thread namesLiam2022-10-031-1/+1
|
* chore: make yuzu REUSE compliantAndrea Pappacoda2022-07-271-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [REUSE] is a specification that aims at making file copyright information consistent, so that it can be both human and machine readable. It basically requires that all files have a header containing copyright and licensing information. When this isn't possible, like when dealing with binary assets, generated files or embedded third-party dependencies, it is permitted to insert copyright information in the `.reuse/dep5` file. Oh, and it also requires that all the licenses used in the project are present in the `LICENSES` folder, that's why the diff is so huge. This can be done automatically with `reuse download --all`. The `reuse` tool also contains a handy subcommand that analyzes the project and tells whether or not the project is (still) compliant, `reuse lint`. Following REUSE has a few advantages over the current approach: - Copyright information is easy to access for users / downstream - Files like `dist/license.md` do not need to exist anymore, as `.reuse/dep5` is used instead - `reuse lint` makes it easy to ensure that copyright information of files like binary assets / images is always accurate and up to date To add copyright information of files that didn't have it I looked up who committed what and when, for each file. As yuzu contributors do not have to sign a CLA or similar I couldn't assume that copyright ownership was of the "yuzu Emulator Project", so I used the name and/or email of the commit author instead. [REUSE]: https://reuse.software Follow-up to b2eb10382941bef0914f4a0a4685b9033440aa9f
* common: Reduce unused includesameerj2022-03-191-2/+0
|
* backend: Ensure backend_thread is destructed before message_queueMerry2022-03-101-1/+1
| | | | Ensures that stop_token signals that stop has been requested before destruction of conditional_variable
* logging: Convert `backend_thread` into an `std::jthread`Wunkolo2022-02-271-13/+5
| | | | | | Was getting an unhandled `invalid_argument` [exception](https://en.cppreference.com/w/cpp/thread/thread/join) during shutdown on my linux machine. This removes the need for a `StopBackendThread` function entirely since `jthread` [automatically handles both checking if the thread is joinable and stopping the token before attempting to join](https://en.cppreference.com/w/cpp/thread/jthread/~jthread) in the case that `StartBackendThread` was never called.
* Refactor Logging ImplLevi Behunin2021-11-011-27/+37
| | | | | | | Loop on stop_token and remove final_entry in Entry. Move Backend thread out of Impl Constructor to its own function. Add Start function for backend thread. Use stop token in PopWait and check if entry filename is nullptr before logging.
* common/logging: Move Log::Entry declaration to a separate headerameerj2021-10-011-0/+3
| | | | This reduces the load of requiring to include std::chrono in all files which include log.h
* common/logging: Add missing includegerman772021-09-011-0/+1
|
* Revert "logging: Display backtrace on crash"Morph2021-08-271-111/+1
|
* Merge pull request #6870 from yzct12345/trace-back-stack-back-stack-backbunnei2021-08-261-1/+111
|\ | | | | logging: Display backtrace on crash
| * logging: Display backtrace on crashyzct123452021-08-131-1/+111
| | | | | | | | | | | | | | This implements backtraces so we don't have to tell users how to use gdb anymore. This prints a backtrace after abort or segfault is detected. It also fixes the log getting cut off with the last line containing only a bracket. This change lets us know what caused a crash not just what happened the few seconds before it. I only know how to add support for Linux with GCC. Also this doesn't work outside of C/C++ such as in dynarmic or certain parts of graphics drivers. The good thing is that it'll try and just crash again but the stack frames are still there so the core dump will work just like before.
* | logging: Fix log filter during initializationameerj2021-08-241-4/+5
|/ | | | | | The log filter was being ignored on initialization due to the logging instance being initialized before the config instance, so the log filter was set to its default value. This fixes that oversight, along with using descriptive exceptions instead of abort() calls.
* logging: Simplify and make thread-safeyzct123452021-08-131-139/+211
| | | | | | | | | This simplifies the logging system. This also fixes some lost messages on startup. The simplification is simple. I removed unused functions and moved most things in the .h to the .cpp. I replaced the unnecessary linked list with its contents laid out as three member variables. Anything that went through the linked list now directly accesses the backends. Generic functions are replaced with those for each specific use case and there aren't many. This change increases coupling but we gain back more KISS and encapsulation. With those changes it was easy to make it thread-safe. I just removed the mutex and turned a boolean atomic. I was planning to use this thread-safety in my next PR about stacktraces. It was actually async-signal-safety at first but I ended up using a different approach. Anyway getting rid of the linked list is important for that because have the list of backends constantly changing complicates things.
* common: logging: backend: Close the file after exceeding the write limitMorph2021-07-061-8/+11
| | | | There's no point in keeping the file open after the write limit is exceeded. This allows the file to be committed to the disk shortly after it is closed and avoids redundantly checking whether or not the write limit is exceeded.
* common: Replace common_sizes into user-literalsWunkolo2021-06-241-4/+7
| | | | | | | | | | | | | Removes common_sizes.h in favor of having `_KiB`, `_MiB`, `_GiB`, etc user-literals within literals.h. To keep the global namespace clean, users will have to use: ``` using namespace Common::Literals; ``` to access these literals.
* common: fs: file: Remove [[nodiscard]] attribute from FlushMorph2021-06-221-1/+1
| | | | Similarly, Flush() is typically called to attempt to flush a file into the disk. In the one case where this is used, we do not care whether the flush has succeeded or not, making [[nodiscard]] unnecessary.
* common: fs: Remove [[nodiscard]] attribute on Remove* functionsMorph2021-06-221-1/+1
| | | | | | There are a lot of scenarios where we don't particularly care whether or not the removal operation and just simply attempt a removal. As such, removing the [[nodiscard]] attribute is best for these functions.
* common: logging: Restructure backend codeMorph2021-06-131-129/+0
|
* common: logging: backend: Wrap IOFile in a unique_ptrMorph2021-06-131-4/+14
| | | | Allows us to forward declare Common::FS::IOFile.
* common: fs: Rework the Common Filesystem interface to make use of ↵Morph2021-05-251-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::filesystem (#6270) * common: fs: fs_types: Create filesystem types Contains various filesystem types used by the Common::FS library * common: fs: fs_util: Add std::string to std::u8string conversion utility * common: fs: path_util: Add utlity functions for paths Contains various utility functions for getting or manipulating filesystem paths used by the Common::FS library * common: fs: file: Rewrite the IOFile implementation * common: fs: Reimplement Common::FS library using std::filesystem * common: fs: fs_paths: Add fs_paths to replace common_paths * common: fs: path_util: Add the rest of the path functions * common: Remove the previous Common::FS implementation * general: Remove unused fs includes * string_util: Remove unused function and include * nvidia_flags: Migrate to the new Common::FS library * settings: Migrate to the new Common::FS library * logging: backend: Migrate to the new Common::FS library * core: Migrate to the new Common::FS library * perf_stats: Migrate to the new Common::FS library * reporter: Migrate to the new Common::FS library * telemetry_session: Migrate to the new Common::FS library * key_manager: Migrate to the new Common::FS library * bis_factory: Migrate to the new Common::FS library * registered_cache: Migrate to the new Common::FS library * xts_archive: Migrate to the new Common::FS library * service: acc: Migrate to the new Common::FS library * applets/profile: Migrate to the new Common::FS library * applets/web: Migrate to the new Common::FS library * service: filesystem: Migrate to the new Common::FS library * loader: Migrate to the new Common::FS library * gl_shader_disk_cache: Migrate to the new Common::FS library * nsight_aftermath_tracker: Migrate to the new Common::FS library * vulkan_library: Migrate to the new Common::FS library * configure_debug: Migrate to the new Common::FS library * game_list_worker: Migrate to the new Common::FS library * config: Migrate to the new Common::FS library * configure_filesystem: Migrate to the new Common::FS library * configure_per_game_addons: Migrate to the new Common::FS library * configure_profile_manager: Migrate to the new Common::FS library * configure_ui: Migrate to the new Common::FS library * input_profiles: Migrate to the new Common::FS library * yuzu_cmd: config: Migrate to the new Common::FS library * yuzu_cmd: Migrate to the new Common::FS library * vfs_real: Migrate to the new Common::FS library * vfs: Migrate to the new Common::FS library * vfs_libzip: Migrate to the new Common::FS library * service: bcat: Migrate to the new Common::FS library * yuzu: main: Migrate to the new Common::FS library * vfs_real: Delete the contents of an existing file in CreateFile Current usages of CreateFile expect to delete the contents of an existing file, retain this behavior for now. * input_profiles: Don't iterate the input profile dir if it does not exist Silences an error produced in the log if the directory does not exist. * game_list_worker: Skip parsing file if the returned VfsFile is nullptr Prevents crashes in GetLoader when the virtual file is nullptr * common: fs: Validate paths for path length * service: filesystem: Open the mod load directory as read only
* log/backend: Use in-class initializer for FileBackendLioncash2021-04-201-4/+6
| | | | We can also avoid redundant constructions of the same string repeatedly.
* log/backend: Make use of erase_ifLioncash2021-04-201-4/+4
| | | | Same behavior, but less verbose.
* Merge pull request #6199 from lioncash/log-nsbunnei2021-04-141-11/+14
|\ | | | | common/log: Move Log namespace into the Common namespace
| * log/backend: Correct order of const in copy constructorLioncash2021-04-141-2/+5
| | | | | | | | | | Follows our predominant coding style. Also explicitly specifies the move constructor/assignment operator as well.
| * common/log: Move Log namespace into the Common namespaceLioncash2021-04-141-9/+9
| | | | | | | | | | Forgot to move this over when I moved the rest of the source files with lacking namespaces over.
* | common: Move settings to common from core.bunnei2021-04-141-1/+1
|/ | | | - Removes a dependency on core and input_common from common.
* bgtc: Update to 12.x and implement OpenTaskServiceMorph2021-04-091-0/+1
|
* Address review commentsFearlessTobi2021-01-041-5/+5
|
* Delete the old log file before rotating (#5675)xperia642021-01-041-0/+3
|
* Fix the old log file to work with the log parser.bunnei2021-01-031-1/+1
|
* Rotate previous log file to '.old' if it existsxperia642021-01-031-4/+9
|