mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-26 19:32:40 -06:00
b88c91dd3d
It provided a large increase in complexity of the logging system while having a negligible performance impact: the usage patterns of the ring buffer meant that each log contended with the logging thread, causing it to effectively act as a synchronous extra buffering. Also removed some broken code related to filtering of subclasses which was broken since it was introduced. (Which means no one ever used that feature anyway, since, 8 months later, no one ever complained.)
32 lines
1.2 KiB
C++
32 lines
1.2 KiB
C++
// Copyright 2014 Citra Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <cstddef>
|
|
|
|
namespace Log {
|
|
|
|
struct Entry;
|
|
|
|
/**
|
|
* Attempts to trim an arbitrary prefix from `path`, leaving only the part starting at `root`. It's
|
|
* intended to be used to strip a system-specific build directory from the `__FILE__` macro,
|
|
* leaving only the path relative to the sources root.
|
|
*
|
|
* @param path The input file path as a null-terminated string
|
|
* @param root The name of the root source directory as a null-terminated string. Path up to and
|
|
* including the last occurence of this name will be stripped
|
|
* @return A pointer to the same string passed as `path`, but starting at the trimmed portion
|
|
*/
|
|
const char* TrimSourcePath(const char* path, const char* root = "src");
|
|
|
|
/// Formats a log entry into the provided text buffer.
|
|
void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len);
|
|
/// Formats and prints a log entry to stderr.
|
|
void PrintMessage(const Entry& entry);
|
|
/// Prints the same message as `PrintMessage`, but colored acoording to the severity level.
|
|
void PrintColoredMessage(const Entry& entry);
|
|
|
|
}
|