aboutsummaryrefslogtreecommitdiff
path: root/src/common/logging/backend.cpp
AgeCommit message (Collapse)Author
2022-03-19common: Reduce unused includesameerj
2022-03-10backend: Ensure backend_thread is destructed before message_queueMerry
Ensures that stop_token signals that stop has been requested before destruction of conditional_variable
2022-02-27logging: Convert `backend_thread` into an `std::jthread`Wunkolo
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.
2021-11-01 Refactor Logging ImplLevi Behunin
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.
2021-10-01common/logging: Move Log::Entry declaration to a separate headerameerj
This reduces the load of requiring to include std::chrono in all files which include log.h
2021-09-01common/logging: Add missing includegerman77
2021-08-27Revert "logging: Display backtrace on crash"Morph
2021-08-26Merge pull request #6870 from yzct12345/trace-back-stack-back-stack-backbunnei
logging: Display backtrace on crash
2021-08-24logging: Fix log filter during initializationameerj
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.
2021-08-13logging: Display backtrace on crashyzct12345
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.
2021-08-13logging: Simplify and make thread-safeyzct12345
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.
2021-07-06common: logging: backend: Close the file after exceeding the write limitMorph
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.
2021-06-24common: Replace common_sizes into user-literalsWunkolo
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.
2021-06-22common: fs: file: Remove [[nodiscard]] attribute from FlushMorph
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.
2021-06-22common: fs: Remove [[nodiscard]] attribute on Remove* functionsMorph
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.
2021-06-13common: logging: Restructure backend codeMorph
2021-06-13common: logging: backend: Wrap IOFile in a unique_ptrMorph
Allows us to forward declare Common::FS::IOFile.
2021-05-25common: fs: Rework the Common Filesystem interface to make use of ↵Morph
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
2021-04-20log/backend: Use in-class initializer for FileBackendLioncash
We can also avoid redundant constructions of the same string repeatedly.
2021-04-20log/backend: Make use of erase_ifLioncash
Same behavior, but less verbose.
2021-04-14Merge pull request #6199 from lioncash/log-nsbunnei
common/log: Move Log namespace into the Common namespace
2021-04-14log/backend: Correct order of const in copy constructorLioncash
Follows our predominant coding style. Also explicitly specifies the move constructor/assignment operator as well.
2021-04-14common/log: Move Log namespace into the Common namespaceLioncash
Forgot to move this over when I moved the rest of the source files with lacking namespaces over.
2021-04-14common: Move settings to common from core.bunnei
- Removes a dependency on core and input_common from common.
2021-04-09bgtc: Update to 12.x and implement OpenTaskServiceMorph
2021-01-04Address review commentsFearlessTobi
2021-01-04Delete the old log file before rotating (#5675)xperia64
2021-01-03Fix the old log file to work with the log parser.bunnei
2021-01-03Rotate previous log file to '.old' if it existsxperia64
2020-11-23Merge pull request #4451 from slashiee/extended-loggingbunnei
logging/settings: Increase maximum log size to 100 MB and add extended logging option
2020-11-19hle: service: Stub OLSC Initialize and SetSaveDataBackupSettingEnabled ↵bunnei
functions. - Used by Animal Cross: New Horizons v1.6.0 update, minimal stub gets this update working.
2020-11-02common: Enable warnings as errorsLioncash
Cleans up common so that we can enable warnings as errors.
2020-08-24logging/settings: Increase maximum log size to 100 MB and add extended ↵M&M
logging option The extended logging option is automatically disabled on boot but can be enabled afterwards, allowing the log file to go up to 1 GB during that session. This commit also fixes a few errors that are present in the general debug menu.
2020-08-03logging/backend: Make use of designated initializersLioncash
Same behavior, less code.
2020-01-23common/logging: don't use regex for path trimmingBreadFish64
2019-11-15common/logging: Silence no return value warningsReinUsesLisp
2019-09-21log: Add logging class for Cheat EngineZach Hilman
This is better than just using something like Common.Filesystem or Common.Memory
2019-04-01general: Use deducation guides for std::lock_guard and std::unique_lockLioncash
Since C++17, the introduction of deduction guides for locking facilities means that we no longer need to hardcode the mutex type into the locks themselves, making it easier to switch mutex types, should it ever be necessary in the future.
2019-03-02logging/backend: Make time_origin a class variable instead of a local staticLioncash
Moves local global state into the Impl class itself and initializes it at the creation of the instance instead of in the function. This makes it nicer for weakly-ordered architectures, given the CreateEntry() class won't need to have atomic loads executed for each individual call to the CreateEntry class.
2019-03-02logging/backend: Move CreateEntry into the Impl classLioncash
This function is only ever used within this source file and makes it easier to remove static state in the following change.
2019-02-15Adressed review commentsB3n30
2019-02-15threadsafe_queue: Add WaitIfEmpty and use it in loggingB3n30
2019-02-12logging: Add Vulkan backend logging class typeReinUsesLisp
2018-12-07Backport review comment from citra-emu/citra#4418Tobias
Original reason: As Windows multi-byte character codec is unspecified while we always assume std::string uses UTF-8 in our code base, this can output gibberish when the string contains non-ASCII characters. ::OutputDebugStringW combined with Common::UTF8ToUTF16W is preferred here.
2018-11-05Merge pull request #1441 from CarlKenner/DebuggerLogbunnei
logging: Add DebuggerBackend for logging to Visual Studio
2018-10-23logging/backend: Add missing services to the log filtersLioncash
Just a few overlooked services.
2018-10-07logging: Add DebuggerBackend for logging to Visual StudioCarl Kenner
2018-09-23Stubbed IRS (#1349)David
* Stubbed IRS Currently we have no ideal way of implementing IRS. For the time being we should have the functions stubbed until we come up with a way to emulate IRS properly. * Added IRS to logging backend * Forward declared shared memory for irs
2018-09-15Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi
2018-08-13logging/backend: Use const reference to refer to log filterLioncash
The filter is returned via const reference, so this was making a pointless copy of the entire filter every time a message was being pushed into the logger instance.