mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-21 07:25:39 -04:00
CDROM: Log command parameters
This commit is contained in:
@ -445,6 +445,20 @@ void Log::SetFileOutputParams(bool enabled, const char* filename, bool timestamp
|
||||
s_file_output_timestamp = timestamps;
|
||||
}
|
||||
|
||||
LOGLEVEL Log::GetLogLevel()
|
||||
{
|
||||
return s_log_level;
|
||||
}
|
||||
|
||||
bool Log::IsLogVisible(LOGLEVEL level, const char* channelName)
|
||||
{
|
||||
if (level > s_log_level)
|
||||
return false;
|
||||
|
||||
std::unique_lock lock(s_callback_mutex);
|
||||
return FilterTest(level, channelName, lock);
|
||||
}
|
||||
|
||||
void Log::SetLogLevel(LOGLEVEL level)
|
||||
{
|
||||
std::unique_lock lock(s_callback_mutex);
|
||||
@ -452,7 +466,7 @@ void Log::SetLogLevel(LOGLEVEL level)
|
||||
s_log_level = level;
|
||||
}
|
||||
|
||||
void Log::SetLogfilter(std::string_view filter)
|
||||
void Log::SetLogFilter(std::string_view filter)
|
||||
{
|
||||
std::unique_lock lock(s_callback_mutex);
|
||||
if (s_log_filter != filter)
|
||||
|
@ -52,11 +52,17 @@ void SetDebugOutputParams(bool enabled);
|
||||
// adds a file output
|
||||
void SetFileOutputParams(bool enabled, const char* filename, bool timestamps = true);
|
||||
|
||||
// Returns the current global filtering level.
|
||||
LOGLEVEL GetLogLevel();
|
||||
|
||||
// Returns true if log messages for the specified log level/filter would not be filtered (and visible).
|
||||
bool IsLogVisible(LOGLEVEL level, const char* channelName);
|
||||
|
||||
// Sets global filtering level, messages below this level won't be sent to any of the logging sinks.
|
||||
void SetLogLevel(LOGLEVEL level);
|
||||
|
||||
// Sets global filter, any messages from these channels won't be sent to any of the logging sinks.
|
||||
void SetLogfilter(std::string_view filter);
|
||||
void SetLogFilter(std::string_view filter);
|
||||
|
||||
// writes a message to the log
|
||||
void Write(const char* channelName, const char* functionName, LOGLEVEL level, std::string_view message);
|
||||
@ -98,6 +104,14 @@ ALWAYS_INLINE static void WriteFmt(const char* channelName, const char* function
|
||||
#define Log_ProfilePrintf(...) Log::Writef(___LogChannel___, __func__, LOGLEVEL_PROFILE, __VA_ARGS__)
|
||||
#define Log_ProfileFmt(...) Log::WriteFmt(___LogChannel___, __func__, LOGLEVEL_PROFILE, __VA_ARGS__)
|
||||
|
||||
#define Log_ErrorVisible() Log::IsLogVisible(LOGLEVEL_ERROR, ___LogChannel___)
|
||||
#define Log_WarningVisible() Log::IsLogVisible(LOGLEVEL_WARNING, ___LogChannel___)
|
||||
#define Log_PerfVisible() Log::IsLogVisible(LOGLEVEL_PERF, ___LogChannel___)
|
||||
#define Log_InfoVisible() Log::IsLogVisible(LOGLEVEL_INFO, ___LogChannel___)
|
||||
#define Log_VerboseVisible() Log::IsLogVisible(LOGLEVEL_VERBOSE, ___LogChannel___)
|
||||
#define Log_DevVisible() Log::IsLogVisible(LOGLEVEL_DEV, ___LogChannel___)
|
||||
#define Log_ProfileVisible() Log::IsLogVisible(LOGLEVEL_PROFILE, ___LogChannel___)
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define Log_DebugPrint(msg) Log::Write(___LogChannel___, __func__, LOGLEVEL_DEBUG, msg)
|
||||
#define Log_DebugPrintf(...) Log::Writef(___LogChannel___, __func__, LOGLEVEL_DEBUG, __VA_ARGS__)
|
||||
@ -105,6 +119,9 @@ ALWAYS_INLINE static void WriteFmt(const char* channelName, const char* function
|
||||
#define Log_TracePrint(msg) Log::Write(___LogChannel___, __func__, LOGLEVEL_TRACE, msg)
|
||||
#define Log_TracePrintf(...) Log::Writef(___LogChannel___, __func__, LOGLEVEL_TRACE, __VA_ARGS__)
|
||||
#define Log_TraceFmt(...) Log::WriteFmt(___LogChannel___, __func__, LOGLEVEL_TRACE, __VA_ARGS__)
|
||||
|
||||
#define Log_DebugVisible() Log::IsLogVisible(LOGLEVEL_DEBUG, ___LogChannel___)
|
||||
#define Log_TraceVisible() Log::IsLogVisible(LOGLEVEL_TRACE, ___LogChannel___)
|
||||
#else
|
||||
#define Log_DebugPrint(msg) \
|
||||
do \
|
||||
@ -130,4 +147,7 @@ ALWAYS_INLINE static void WriteFmt(const char* channelName, const char* function
|
||||
do \
|
||||
{ \
|
||||
} while (0)
|
||||
|
||||
#define Log_DebugVisible() false
|
||||
#define Log_TraceVisible() false
|
||||
#endif
|
||||
|
@ -172,6 +172,18 @@ void SmallStringBase::append(const char* str, u32 length)
|
||||
m_buffer[m_length] = 0;
|
||||
}
|
||||
|
||||
void SmallStringBase::append_hex(const void* data, size_t len)
|
||||
{
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
make_room_for(static_cast<u32>(len) * 4);
|
||||
const u8* bytes = static_cast<const u8*>(data);
|
||||
append_fmt("{:02X}", bytes[0]);
|
||||
for (size_t i = 1; i < len; i++)
|
||||
append_fmt(", {:02X}", bytes[i]);
|
||||
}
|
||||
|
||||
void SmallStringBase::prepend(const char* str, u32 length)
|
||||
{
|
||||
if (length == 0)
|
||||
|
@ -64,6 +64,9 @@ public:
|
||||
template<typename... T>
|
||||
void append_fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
// append hex string
|
||||
void append_hex(const void* data, size_t len);
|
||||
|
||||
// append a single character to this string
|
||||
void prepend(char c);
|
||||
|
||||
|
Reference in New Issue
Block a user