diff options
Diffstat (limited to 'src')
31 files changed, 209 insertions, 252 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 706f0ed0..330c7226 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -2,13 +2,14 @@ add_library(cru_base SHARED Base.cpp Exception.cpp Format.cpp - Logger.cpp PropertyTree.cpp String.cpp StringUtil.cpp io/Stream.cpp io/Resource.cpp io/MemoryStream.cpp + log/Logger.cpp + log/StdioLogTarget.cpp platform/Exception.cpp ) target_compile_definitions(cru_base PRIVATE CRU_BASE_EXPORT_API) diff --git a/src/common/Format.cpp b/src/common/Format.cpp index 3362db65..d58c90b7 100644 --- a/src/common/Format.cpp +++ b/src/common/Format.cpp @@ -46,7 +46,7 @@ FormatToken ParsePlaceHolder(String place_holder_string) { } } -std::vector<FormatToken> ParseToFormatTokenList(const String& str) { +std::vector<FormatToken> ParseToFormatTokenList(StringView str) { std::vector<FormatToken> result; auto push_char = [&result](char16_t c) { diff --git a/src/common/Logger.cpp b/src/common/Logger.cpp deleted file mode 100644 index 49261396..00000000 --- a/src/common/Logger.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "cru/common/Logger.h" - -#include <array> -#include <cstdlib> -#include <ctime> -#include <iostream> -#include <memory> -#include <mutex> -#include <string_view> - -namespace cru::log { -namespace { -Logger *CreateLogger() { - const auto logger = new Logger(); - return logger; -} -} // namespace - -Logger *Logger::GetInstance() { - static std::unique_ptr<Logger> logger{CreateLogger()}; - return logger.get(); -} - -void Logger::AddSource(std::unique_ptr<ILogSource> source) { - sources_.push_back(std::move(source)); -} - -void Logger::RemoveSource(ILogSource *source) { - sources_.remove_if([source](const std::unique_ptr<ILogSource> &s) { - return s.get() == source; - }); -} - -namespace { -String LogLevelToString(LogLevel level) { - switch (level) { - case LogLevel::Debug: - return u"DEBUG"; - case LogLevel::Info: - return u"INFO"; - case LogLevel::Warn: - return u"WARN"; - case LogLevel::Error: - return u"ERROR"; - default: - std::terminate(); - } -} - -String GetLogTime() { - auto time = std::time(nullptr); - auto calendar = std::localtime(&time); - return Format(u"{}:{}:{}", calendar->tm_hour, calendar->tm_min, - calendar->tm_sec); -} -} // namespace - -void Logger::Log(LogLevel level, StringView message) { -#ifndef CRU_DEBUG - if (level == LogLevel::Debug) { - return; - } -#endif - for (const auto &source : sources_) { - source->Write(level, Format(u"[{}] {}: {}\n", GetLogTime(), - LogLevelToString(level), message)); - } -} - -void Logger::Log(LogLevel level, StringView tag, StringView message) { -#ifndef CRU_DEBUG - if (level == LogLevel::Debug) { - return; - } -#endif - for (const auto &source : sources_) { - source->Write(level, Format(u"[{}] {} {}: {}\n", GetLogTime(), - LogLevelToString(level), tag, message)); - } -} - -namespace { -std::mutex stdio_lock; - -void WriteStdio(LogLevel level, StringView s) { - std::string m = s.ToString().ToUtf8(); - - if (level == LogLevel::Error) { - std::cerr << m; - } else { - std::cout << m; - } -} -} // namespace - -StdioLogSource::StdioLogSource(bool use_lock) : use_lock_(use_lock) {} - -StdioLogSource::~StdioLogSource() {} - -void StdioLogSource::Write(LogLevel level, StringView s) { - if (use_lock_) { - std::lock_guard<std::mutex> guard(stdio_lock); - WriteStdio(level, s); - } else { - WriteStdio(level, s); - } -} -} // namespace cru::log diff --git a/src/common/log/Logger.cpp b/src/common/log/Logger.cpp new file mode 100644 index 00000000..bcafde21 --- /dev/null +++ b/src/common/log/Logger.cpp @@ -0,0 +1,86 @@ +#include "cru/common/log/Logger.h" +#include "cru/common/log/StdioLogTarget.h" + +#include <array> +#include <cstdlib> +#include <ctime> + +namespace cru::log { +Logger *Logger::GetInstance() { + static Logger logger; + + logger.AddLogTarget(std::make_unique<StdioLogTarget>()); + + return &logger; +} + +void Logger::AddLogTarget(std::unique_ptr<ILogTarget> target) { + std::lock_guard<std::mutex> lock(target_list_mutex_); + target_list_.push_back(std::move(target)); +} + +void Logger::RemoveLogTarget(ILogTarget *target) { + std::lock_guard<std::mutex> lock(target_list_mutex_); + target_list_.erase( + std::remove_if(target_list_.begin(), target_list_.end(), + [target](const auto &t) { return t.get() == target; }), + target_list_.end()); +} + +namespace { +String LogLevelToString(LogLevel level) { + switch (level) { + case LogLevel::Debug: + return u"DEBUG"; + case LogLevel::Info: + return u"INFO"; + case LogLevel::Warn: + return u"WARN"; + case LogLevel::Error: + return u"ERROR"; + default: + std::terminate(); + } +} + +String GetLogTime() { + auto time = std::time(nullptr); + auto calendar = std::localtime(&time); + return Format(u"{}:{}:{}", calendar->tm_hour, calendar->tm_min, + calendar->tm_sec); +} + +String MakeLogFinalMessage(const LogInfo &log_info) { + if (log_info.tag.empty()) { + return Format(u"[{}] {}: {}", GetLogTime(), + LogLevelToString(log_info.level), log_info.message); + } else { + return Format(u"[{}] {} {}: {}", GetLogTime(), + LogLevelToString(log_info.level), log_info.tag, + log_info.message); + } +} +} // namespace + +Logger::Logger() + : log_thread_([this] { + while (true) { + auto log_info = log_queue_.Pull(); + std::lock_guard<std::mutex> lock_guard{target_list_mutex_}; + for (const auto &target : target_list_) { + target->Write(log_info.level, MakeLogFinalMessage(log_info)); + } + } + }) {} + +Logger::~Logger() {} + +void Logger::Log(LogInfo log_info) { +#ifndef CRU_DEBUG + if (log_info.level == LogLevel::Debug) { + return; + } +#endif + log_queue_.Push(std::move(log_info)); +} +} // namespace cru::log diff --git a/src/common/log/StdioLogTarget.cpp b/src/common/log/StdioLogTarget.cpp new file mode 100644 index 00000000..ad29a3ce --- /dev/null +++ b/src/common/log/StdioLogTarget.cpp @@ -0,0 +1,22 @@ +#include "cru/common/log/StdioLogTarget.h" + +#include <iostream> + +namespace cru::log { +StdioLogTarget::StdioLogTarget() {} + +StdioLogTarget::~StdioLogTarget() {} + +void StdioLogTarget::Write(log::LogLevel level, StringView s) { +#ifdef CRU_PLATFORM_WINDOWS +#else + std::string m = s.ToUtf8(); + + if (level == log::LogLevel::Error) { + std::cerr << m; + } else { + std::cout << m; + } +#endif +} +} // namespace cru::log diff --git a/src/osx/graphics/quartz/Painter.cpp b/src/osx/graphics/quartz/Painter.cpp index d74e456b..a8c3715a 100644 --- a/src/osx/graphics/quartz/Painter.cpp +++ b/src/osx/graphics/quartz/Painter.cpp @@ -1,6 +1,5 @@ #include "cru/osx/graphics/quartz/Painter.h" -#include "cru/common/Logger.h" #include "cru/osx/graphics/quartz/Brush.h" #include "cru/osx/graphics/quartz/Convert.h" #include "cru/osx/graphics/quartz/Geometry.h" @@ -27,10 +26,6 @@ QuartzCGContextPainter::QuartzCGContextPainter( transform_ = Matrix::Scale(1, -1) * Matrix::Translation(0, size.height); CGContextConcatCTM(cg_context_, Convert(transform_)); - - // log::TagDebug(log_tag, - // u"Created with CGContext: {}, Auto Release: {}, Size: {}.", - // cg_context, auto_release, size_); } QuartzCGContextPainter::~QuartzCGContextPainter() { @@ -61,8 +56,6 @@ void QuartzCGContextPainter::Clear(const Color& color) { color.GetFloatGreen(), color.GetFloatBlue(), color.GetFloatAlpha()); CGContextFillRect(cg_context_, Convert(Rect{Point{}, size_})); - - // log::TagDebug(log_tag, u"Clear with color {}, size {}.", color, size_); } void QuartzCGContextPainter::DrawLine(const Point& start, const Point& end, @@ -225,7 +218,6 @@ void QuartzCGContextPainter::DoEndDraw() { if (cg_context_) { CGContextFlush(cg_context_); CGContextSynchronize(cg_context_); - // log::TagDebug(log_tag, u"End draw and flush."); on_end_draw_(this); } diff --git a/src/osx/gui/Clipboard.mm b/src/osx/gui/Clipboard.mm index b37efce2..6e3fb076 100644 --- a/src/osx/gui/Clipboard.mm +++ b/src/osx/gui/Clipboard.mm @@ -1,7 +1,7 @@ #include "cru/osx/gui/Clipboard.h" #include "ClipboardPrivate.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/osx/Convert.h" #include <memory> @@ -27,7 +27,7 @@ OsxClipboardPrivate::~OsxClipboardPrivate() {} String OsxClipboardPrivate::GetText() { auto result = [pasteboard_ readObjectsForClasses:@[ NSString.class ] options:nil]; if (result == nil) { - log::TagWarn(log_tag, u"Failed to get text from clipboard"); + CRU_LOG_WARN(u"Failed to get text from clipboard"); return u""; } else { if (result.count == 0) { diff --git a/src/osx/gui/ClipboardPrivate.h b/src/osx/gui/ClipboardPrivate.h index 93fe5448..63145a64 100644 --- a/src/osx/gui/ClipboardPrivate.h +++ b/src/osx/gui/ClipboardPrivate.h @@ -7,8 +7,7 @@ namespace cru::platform::gui::osx { namespace details { class OsxClipboardPrivate : public Object { - CRU_DEFINE_CLASS_LOG_TAG( - u"cru::platform::gui::osx::details::OsxClipboardPrivate") + CRU_DEFINE_CLASS_LOG_TAG(u"OsxClipboardPrivate") public: explicit OsxClipboardPrivate(NSPasteboard* pasteboard); diff --git a/src/osx/gui/InputMethod.mm b/src/osx/gui/InputMethod.mm index 3a961209..2c19c358 100644 --- a/src/osx/gui/InputMethod.mm +++ b/src/osx/gui/InputMethod.mm @@ -3,7 +3,7 @@ #import <AppKit/AppKit.h> #include "InputMethodPrivate.h" #include "WindowPrivate.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/osx/Convert.h" #include "cru/osx/gui/Window.h" @@ -46,15 +46,9 @@ OsxInputMethodContext::OsxInputMethodContext(OsxWindow* window) OsxInputMethodContext::~OsxInputMethodContext() {} -void OsxInputMethodContext::EnableIME() { - // log::Debug(u"Enable IME."); - p_->Activate(); -} +void OsxInputMethodContext::EnableIME() { p_->Activate(); } -void OsxInputMethodContext::DisableIME() { - // log::Debug(u"Disable IME."); - p_->Deactivate(); -} +void OsxInputMethodContext::DisableIME() { p_->Deactivate(); } bool OsxInputMethodContext::ShouldManuallyDrawCompositionText() { return true; } diff --git a/src/osx/gui/UiApplication.mm b/src/osx/gui/UiApplication.mm index 20ce82d3..43c49c5c 100644 --- a/src/osx/gui/UiApplication.mm +++ b/src/osx/gui/UiApplication.mm @@ -1,7 +1,7 @@ #include "cru/osx/gui/UiApplication.h" #include "ClipboardPrivate.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/common/platform/osx/Convert.h" #include "cru/osx/graphics/quartz/Factory.h" #include "cru/osx/gui/Clipboard.h" @@ -80,9 +80,6 @@ OsxUiApplication::OsxUiApplication() : OsxGuiResource(this), p_(new details::OsxUiApplicationPrivate(this)) { [NSApplication sharedApplication]; - // Add stdio logger. - log::Logger::GetInstance()->AddSource(std::make_unique<log::StdioLogSource>()); - [NSApp setDelegate:p_->app_delegate_]; p_->quartz_graphics_factory_ = std::make_unique<graphics::osx::quartz::QuartzGraphicsFactory>(); p_->cursor_manager_ = std::make_unique<OsxCursorManager>(this); diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm index 403ae030..8d15ef37 100644 --- a/src/osx/gui/Window.mm +++ b/src/osx/gui/Window.mm @@ -3,8 +3,8 @@ #include "CursorPrivate.h" #include "InputMethodPrivate.h" -#include "cru/common/Logger.h" #include "cru/common/Range.h" +#include "cru/common/log/Logger.h" #include "cru/osx/Convert.h" #include "cru/osx/graphics/quartz/Convert.h" #include "cru/osx/graphics/quartz/Painter.h" @@ -351,7 +351,6 @@ std::unique_ptr<graphics::IPainter> OsxWindow::BeginPaint() { return std::make_unique<cru::platform::graphics::osx::quartz::QuartzCGContextPainter>( GetUiApplication()->GetGraphicsFactory(), cg_context, false, GetClientSize(), [this](graphics::osx::quartz::QuartzCGContextPainter*) { - // log::Debug(u"Finish painting and invalidate view."); [[p_->window_ contentView] setNeedsDisplay:YES]; }); } @@ -470,7 +469,6 @@ cru::platform::gui::KeyModifier GetKeyModifier(NSEvent* event) { } - (void)drawRect:(NSRect)dirtyRect { - // cru::log::TagDebug(u"CruView", u"Begin to draw layer in view."); auto cg_context = [[NSGraphicsContext currentContext] CGContext]; auto layer = _p->GetDrawLayer(); Ensures(layer); @@ -486,32 +484,26 @@ cru::platform::gui::KeyModifier GetKeyModifier(NSEvent* event) { } - (void)mouseMoved:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse move."); _p->OnMouseMove(cru::platform::Point(event.locationInWindow.x, event.locationInWindow.y)); } - (void)mouseDragged:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse move."); _p->OnMouseMove(cru::platform::Point(event.locationInWindow.x, event.locationInWindow.y)); } - (void)rightMouseDragged:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse move."); _p->OnMouseMove(cru::platform::Point(event.locationInWindow.x, event.locationInWindow.y)); } - (void)mouseEntered:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse enter."); _p->OnMouseEnterLeave(cru::platform::gui::MouseEnterLeaveType::Enter); } - (void)mouseExited:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse exit."); _p->OnMouseEnterLeave(cru::platform::gui::MouseEnterLeaveType::Leave); } - (void)mouseDown:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse down."); [[self window] makeKeyWindow]; auto key_modifier = GetKeyModifier(event); @@ -521,8 +513,6 @@ cru::platform::gui::KeyModifier GetKeyModifier(NSEvent* event) { } - (void)mouseUp:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse up."); - auto key_modifier = GetKeyModifier(event); cru::platform::Point p(event.locationInWindow.x, event.locationInWindow.y); @@ -530,8 +520,6 @@ cru::platform::gui::KeyModifier GetKeyModifier(NSEvent* event) { } - (void)rightMouseDown:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved right mouse down."); - auto key_modifier = GetKeyModifier(event); cru::platform::Point p(event.locationInWindow.x, event.locationInWindow.y); @@ -539,8 +527,6 @@ cru::platform::gui::KeyModifier GetKeyModifier(NSEvent* event) { } - (void)rightMouseUp:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved right mouse up."); - auto key_modifier = GetKeyModifier(event); cru::platform::Point p(event.locationInWindow.x, event.locationInWindow.y); @@ -548,8 +534,6 @@ cru::platform::gui::KeyModifier GetKeyModifier(NSEvent* event) { } - (void)scrollWheel:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved mouse wheel."); - auto key_modifier = GetKeyModifier(event); cru::platform::Point p(event.locationInWindow.x, event.locationInWindow.y); @@ -620,10 +604,6 @@ const std::unordered_set<KeyCode> input_context_handle_codes_when_has_text{ KeyCode::Right, KeyCode::Up, KeyCode::Down}; - (void)keyDown:(NSEvent*)event { - if constexpr (key_down_debug) { - cru::log::TagDebug(u"CruView", u"Recieved key down."); - } - auto key_modifier = GetKeyModifier(event); bool handled = false; @@ -655,15 +635,11 @@ const std::unordered_set<KeyCode> input_context_handle_codes_when_has_text{ if (!handled) { _p->OnKeyDown(c, key_modifier); - } else { - if constexpr (key_down_debug) { - cru::log::TagDebug(u"CruView", u"Key down is handled by input context."); - } } } - (void)keyUp:(NSEvent*)event { - // cru::log::TagDebug(u"CruView", u"Recieved key up."); + // cru::CRU_LOG_DEBUG(u"CruView", u"Recieved key up."); auto key_modifier = GetKeyModifier(event); auto c = cru::platform::gui::osx::KeyCodeFromOsxToCru(event.keyCode); @@ -698,7 +674,7 @@ const std::unordered_set<KeyCode> input_context_handle_codes_when_has_text{ auto ss = Convert(s); - // cru::log::TagDebug(u"CruView", + // cru::CRU_LOG_DEBUG(u"CruView", // u"Received setMarkedText string: {}, selected range: ({}, {}), " // u"replacement range: ({}, {}).", // ss, selectedRange.location, selectedRange.length, replacementRange.location, @@ -759,7 +735,7 @@ const std::unordered_set<KeyCode> input_context_handle_codes_when_has_text{ _input_context_p->SetCompositionText(cru::platform::gui::CompositionText()); cru::String ss = Convert(s); - // cru::log::TagDebug(u"CruView", u"Finish composition: {}, replacement range: ({}, {})", ss, + // cru::CRU_LOG_DEBUG(u"CruView", u"Finish composition: {}, replacement range: ({}, {})", ss, // replacementRange.location, replacementRange.length); _input_context_p->RaiseCompositionEvent(); diff --git a/src/ui/controls/TextHostControlService.cpp b/src/ui/controls/TextHostControlService.cpp index 81365a8b..15d9102c 100644 --- a/src/ui/controls/TextHostControlService.cpp +++ b/src/ui/controls/TextHostControlService.cpp @@ -2,7 +2,7 @@ #include "../Helper.h" #include "cru/common/Base.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/common/String.h" #include "cru/common/StringUtil.h" #include "cru/platform/graphics/Font.h" @@ -226,7 +226,7 @@ void TextHostControlService::SetText(String text, bool stop_composition) { void TextHostControlService::InsertText(gsl::index position, StringView text, bool stop_composition) { if (!Utf16IsValidInsertPosition(this->text_, position)) { - log::TagError(log_tag, u"Invalid text insert position."); + CRU_LOG_ERROR(u"Invalid text insert position."); return; } this->text_.insert(this->text_.cbegin() + position, text); @@ -240,7 +240,7 @@ void TextHostControlService::InsertText(gsl::index position, StringView text, void TextHostControlService::DeleteChar(gsl::index position, bool stop_composition) { if (!Utf16IsValidInsertPosition(this->text_, position)) { - log::TagError(log_tag, u"Invalid text delete position."); + CRU_LOG_ERROR(u"Invalid text delete position."); return; } if (position == static_cast<gsl::index>(this->text_.size())) return; @@ -253,7 +253,7 @@ void TextHostControlService::DeleteChar(gsl::index position, gsl::index TextHostControlService::DeleteCharPrevious(gsl::index position, bool stop_composition) { if (!Utf16IsValidInsertPosition(this->text_, position)) { - log::TagError(log_tag, u"Invalid text delete position."); + CRU_LOG_ERROR(u"Invalid text delete position."); return 0; } if (position == 0) return 0; @@ -269,11 +269,11 @@ void TextHostControlService::DeleteText(TextRange range, if (range.count == 0) return; range = range.Normalize(); if (!Utf16IsValidInsertPosition(this->text_, range.GetStart())) { - log::TagError(log_tag, u"Invalid text delete start position."); + CRU_LOG_ERROR(u"Invalid text delete start position."); return; } if (!Utf16IsValidInsertPosition(this->text_, range.GetStart())) { - log::TagError(log_tag, u"Invalid text delete end position."); + CRU_LOG_ERROR(u"Invalid text delete end position."); return; } this->text_.erase(this->text_.cbegin() + range.GetStart(), @@ -465,7 +465,7 @@ void TextHostControlService::UpdateInputMethodPosition() { right_bottom.y += 5; if constexpr (debug_flags::text_service) { - log::TagDebug(log_tag, + CRU_LOG_DEBUG( u"Calculate input method candidate window position: {}.", right_bottom); } diff --git a/src/ui/helper/ClickDetector.cpp b/src/ui/helper/ClickDetector.cpp index a10133e9..8ebdfabc 100644 --- a/src/ui/helper/ClickDetector.cpp +++ b/src/ui/helper/ClickDetector.cpp @@ -1,6 +1,6 @@ #include "cru/ui/helper/ClickDetector.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/ui/DebugFlags.h" #include "cru/ui/controls/Control.h" #include "cru/ui/host/WindowHost.h" @@ -58,7 +58,7 @@ ClickDetector::ClickDetector(controls::Control* control) { this->state_ == ClickState::Hover) { if (!this->control_->CaptureMouse()) { if constexpr (debug_flags::click_detector) { - log::TagDebug(log_tag, + CRU_LOG_DEBUG( u"Failed to capture mouse when begin click."); } return; @@ -136,7 +136,7 @@ void ClickDetector::SetState(ClickState state) { UnreachableCode(); } }; - log::TagDebug(log_tag, u"Click state changed, new state: {}.", + CRU_LOG_DEBUG(u"Click state changed, new state: {}.", to_string(state)); } diff --git a/src/ui/helper/ShortcutHub.cpp b/src/ui/helper/ShortcutHub.cpp index 3df07409..8fbf0b8d 100644 --- a/src/ui/helper/ShortcutHub.cpp +++ b/src/ui/helper/ShortcutHub.cpp @@ -1,6 +1,6 @@ #include "cru/ui/helper/ShortcutHub.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/ui/DebugFlags.h" #include "cru/ui/controls/Control.h" @@ -64,7 +64,7 @@ const std::vector<ShortcutInfo>& ShortcutHub::GetShortcutByKeyBind( void ShortcutHub::Install(controls::Control* control) { if (!event_guard_.IsEmpty()) { - log::Error(u"Shortcut hub is already installed. Failed to install."); + CRU_LOG_ERROR(u"Shortcut hub is already installed. Failed to install."); return; } @@ -74,7 +74,7 @@ void ShortcutHub::Install(controls::Control* control) { void ShortcutHub::Uninstall() { if (event_guard_.IsEmpty()) { - log::Warn(u"Shortcut hub is not installed. Failed to uninstall."); + CRU_LOG_WARN(u"Shortcut hub is not installed. Failed to uninstall."); return; } @@ -89,17 +89,17 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) { if constexpr (debug_flags::shortcut) { if (shortcut_list.empty()) { - log::Debug(u"No shortcut for key bind {}.", key_bind.ToString()); + CRU_LOG_DEBUG(u"No shortcut for key bind {}.", key_bind.ToString()); } - log::Debug(u"Begin to handle shortcut for key bind {}.", - key_bind.ToString()); + CRU_LOG_DEBUG(u"Begin to handle shortcut for key bind {}.", + key_bind.ToString()); } for (const auto& shortcut : shortcut_list) { auto is_handled = shortcut.handler(); if (is_handled) { if constexpr (debug_flags::shortcut) { - log::Debug(u"Handle {} handled it.", shortcut.name); + CRU_LOG_DEBUG(u"Handle {} handled it.", shortcut.name); } handled = true; @@ -108,22 +108,23 @@ void ShortcutHub::OnKeyDown(events::KeyEventArgs& event) { break; } else { if constexpr (debug_flags::shortcut) { - log::Debug(u"Handle {} didn't handle it.", shortcut.name); + CRU_LOG_DEBUG(u"Handle {} didn't handle it.", shortcut.name); } } } if constexpr (debug_flags::shortcut) { if (!shortcut_list.empty()) { - log::Debug(u"End handling shortcut for key bind {}.", - key_bind.ToString()); + CRU_LOG_DEBUG(u"End handling shortcut for key bind {}.", + key_bind.ToString()); } } if (!handled) { if constexpr (debug_flags::shortcut) { - log::Debug(u"Raise fallback event for unhandled shortcut of key bind {}.", - key_bind.ToString()); + CRU_LOG_DEBUG( + u"Raise fallback event for unhandled shortcut of key bind {}.", + key_bind.ToString()); } fallback_event_.Raise(event); } diff --git a/src/ui/host/RoutedEventDispatch.h b/src/ui/host/RoutedEventDispatch.h index 2ab51645..3c2a98d8 100644 --- a/src/ui/host/RoutedEventDispatch.h +++ b/src/ui/host/RoutedEventDispatch.h @@ -1,5 +1,5 @@ #pragma once -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/ui/DebugFlags.h" #include "cru/ui/controls/Control.h" @@ -21,18 +21,19 @@ namespace cru::ui { // as the rest arguments. template <typename EventArgs, typename... Args> void DispatchEvent( - const std::u16string_view& event_name, - controls::Control* const original_sender, + const String& event_name, controls::Control* const original_sender, events::RoutedEvent<EventArgs>* (controls::Control::*event_ptr)(), controls::Control* const last_receiver, Args&&... args) { + constexpr auto kLogTag = u"DispatchEvent"; + if (original_sender == nullptr) return; CRU_UNUSED(event_name) if (original_sender == last_receiver) { if constexpr (debug_flags::routed_event) - log::Debug( - "Routed event {} no need to dispatch (original_sender == " + CRU_LOG_DEBUG( + u"Routed event {} no need to dispatch (original_sender == " "last_receiver). Original sender is {}.", event_name, original_sender->GetControlType()); return; @@ -49,7 +50,7 @@ void DispatchEvent( } if constexpr (debug_flags::routed_event) { - std::u16string log = u"Dispatch routed event "; + String log = u"Dispatch routed event "; log += event_name; log += u". Path (parent first): "; auto i = receive_list.crbegin(); @@ -59,7 +60,7 @@ void DispatchEvent( log += u" -> "; } log += (*i)->GetControlType(); - log::Debug(log); + CRU_LOG_DEBUG(log); } auto handled = false; @@ -75,7 +76,7 @@ void DispatchEvent( if (event_args.IsHandled()) { handled = true; if constexpr (debug_flags::routed_event) - log::Debug( + CRU_LOG_DEBUG( u"Routed event is short-circuit in TUNNEL at {}-st control (count " u"from parent).", count); @@ -92,7 +93,7 @@ void DispatchEvent( ->Raise(event_args); if (event_args.IsHandled()) { if constexpr (debug_flags::routed_event) - log::Debug( + CRU_LOG_DEBUG( u"Routed event is short-circuit in BUBBLE at {}-st control " u"(count from parent).", count); @@ -109,6 +110,6 @@ void DispatchEvent( } if constexpr (debug_flags::routed_event) - log::Debug(u"Routed event dispatch finished."); + CRU_LOG_DEBUG(u"Routed event dispatch finished."); } } // namespace cru::ui diff --git a/src/ui/host/WindowHost.cpp b/src/ui/host/WindowHost.cpp index 91b5f438..42d0945f 100644 --- a/src/ui/host/WindowHost.cpp +++ b/src/ui/host/WindowHost.cpp @@ -2,7 +2,7 @@ #include "RoutedEventDispatch.h" #include "cru/common/Base.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/platform/graphics/Painter.h" #include "cru/platform/gui/InputMethod.h" #include "cru/platform/gui/UiApplication.h" @@ -191,7 +191,7 @@ void WindowHost::RelayoutWithSize(const Size& available_size, after_layout_event_.Raise(AfterLayoutEventArgs{}); after_layout_stable_action_.clear(); if constexpr (debug_flags::layout) - log::TagDebug(log_tag, u"A relayout is finished."); + CRU_LOG_DEBUG(u"A relayout is finished."); } void WindowHost::Repaint() { diff --git a/src/ui/mapper/BorderStyleMapper.cpp b/src/ui/mapper/BorderStyleMapper.cpp index 8daa9d1b..3dea0776 100644 --- a/src/ui/mapper/BorderStyleMapper.cpp +++ b/src/ui/mapper/BorderStyleMapper.cpp @@ -1,6 +1,6 @@ #include "cru/ui/mapper/BorderStyleMapper.h" #include "../Helper.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/platform/graphics/Brush.h" #include "cru/platform/graphics/Factory.h" #include "cru/ui/mapper/MapperRegistry.h" @@ -21,7 +21,6 @@ ApplyBorderStyleInfo BorderStyleMapper::DoMapFromXml( for (auto child : node->GetChildren()) { if (child->GetType() == XmlNode::Type::Text) { - log::Debug(u"Ignore text node."); } else { auto c = child->AsElement(); auto thickness_mapper = @@ -43,7 +42,6 @@ ApplyBorderStyleInfo BorderStyleMapper::DoMapFromXml( } else if (name->CaseInsensitiveCompare(u"background") == 0) { result.background_brush = std::move(brush); } else { - log::Debug(u"Unknown brush name: {}", *name); } } else { result.border_brush = std::move(brush); diff --git a/src/ui/render/BorderRenderObject.cpp b/src/ui/render/BorderRenderObject.cpp index 30493a49..cbea4b81 100644 --- a/src/ui/render/BorderRenderObject.cpp +++ b/src/ui/render/BorderRenderObject.cpp @@ -1,7 +1,7 @@ #include "cru/ui/render/BorderRenderObject.h" #include "../Helper.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/platform/graphics/Factory.h" #include "cru/platform/graphics/Geometry.h" #include "cru/platform/graphics/Painter.h" @@ -80,8 +80,8 @@ RenderObject* BorderRenderObject::HitTest(const Point& point) { void BorderRenderObject::Draw(platform::graphics::IPainter* painter) { if constexpr (debug_flags::draw) { - log::TagDebug( - log_tag, u"BorderRenderObject draw, background: {}, foreground: {}.", + CRU_LOG_DEBUG( + u"BorderRenderObject draw, background: {}, foreground: {}.", background_brush_ == nullptr ? u"NONE" : background_brush_->GetDebugString(), foreground_brush_ == nullptr ? u"NONE" @@ -94,7 +94,7 @@ void BorderRenderObject::Draw(platform::graphics::IPainter* painter) { if (is_border_enabled_) { if (border_brush_ == nullptr) { - log::TagWarn(log_tag, u"Border is enabled but border brush is null."); + CRU_LOG_WARN(u"Border is enabled but border brush is null."); } else { painter->FillGeometry(geometry_.get(), border_brush_.get()); } diff --git a/src/ui/render/FlexLayoutRenderObject.cpp b/src/ui/render/FlexLayoutRenderObject.cpp index 0699768a..988e7590 100644 --- a/src/ui/render/FlexLayoutRenderObject.cpp +++ b/src/ui/render/FlexLayoutRenderObject.cpp @@ -1,6 +1,6 @@ #include "cru/ui/render/FlexLayoutRenderObject.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/ui/render/LayoutHelper.h" #include <algorithm> @@ -90,7 +90,7 @@ Size FlexLayoutMeasureContentImpl( const MeasureRequirement& requirement, const MeasureSize& preferred_size, const std::vector<RenderObject*>& children, const std::vector<FlexChildLayoutData>& layout_data, - Alignment item_cross_align, StringView log_tag) { + Alignment item_cross_align, String kLogTag) { Expects(children.size() == layout_data.size()); direction_tag_t direction_tag; @@ -300,8 +300,7 @@ Size FlexLayoutMeasureContentImpl( if (max_main_length.IsSpecified() && total_length > max_main_length.GetLengthOrUndefined()) { - log::TagWarn( - log_tag, + CRU_LOG_WARN( u"(Measure) Children's main axis length exceeds required max length."); total_length = max_main_length.GetLengthOrUndefined(); } else if (min_main_length.IsSpecified() && @@ -345,11 +344,11 @@ Size FlexLayoutRenderObject::OnMeasureContent( if (horizontal) { return FlexLayoutMeasureContentImpl<tag_horizontal_t>( requirement, preferred_size, children, layout_data_list, - item_cross_align_, log_tag); + item_cross_align_, kLogTag); } else { return FlexLayoutMeasureContentImpl<tag_vertical_t>( requirement, preferred_size, children, layout_data_list, - item_cross_align_, log_tag); + item_cross_align_, kLogTag); } } diff --git a/src/ui/render/LayoutHelper.cpp b/src/ui/render/LayoutHelper.cpp index 7a82bb2d..a9121321 100644 --- a/src/ui/render/LayoutHelper.cpp +++ b/src/ui/render/LayoutHelper.cpp @@ -1,6 +1,6 @@ #include "cru/ui/render/LayoutHelper.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" namespace cru::ui::render { float CalculateAnchorByAlignment(Alignment alignment, float start_point, diff --git a/src/ui/render/RenderObject.cpp b/src/ui/render/RenderObject.cpp index 6c09ce99..b6de5782 100644 --- a/src/ui/render/RenderObject.cpp +++ b/src/ui/render/RenderObject.cpp @@ -1,6 +1,6 @@ #include "cru/ui/render/RenderObject.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/ui/DebugFlags.h" #include "cru/ui/controls/Control.h" #include "cru/ui/host/WindowHost.h" @@ -80,16 +80,16 @@ void RenderObject::Measure(const MeasureRequirement& requirement, preferred_size.OverrideBy(preferred_size_); if constexpr (cru::ui::debug_flags::layout) { - log::Debug(u"{} Measure begins :\nrequirement: {}\npreferred size: {}", - this->GetDebugPathInTree(), requirement.ToDebugString(), - preferred_size.ToDebugString()); + CRU_LOG_DEBUG(u"{} Measure begins :\nrequirement: {}\npreferred size: {}", + this->GetDebugPathInTree(), requirement.ToDebugString(), + preferred_size.ToDebugString()); } desired_size_ = OnMeasureCore(merged_requirement, merged_preferred_size); if constexpr (cru::ui::debug_flags::layout) { - log::Debug(u"{} Measure ends :\nresult size: {}", - this->GetDebugPathInTree(), desired_size_); + CRU_LOG_DEBUG(u"{} Measure ends :\nresult size: {}", + this->GetDebugPathInTree(), desired_size_); } Ensures(desired_size_.width >= 0); @@ -98,8 +98,8 @@ void RenderObject::Measure(const MeasureRequirement& requirement, void RenderObject::Layout(const Point& offset) { if constexpr (cru::ui::debug_flags::layout) { - log::Debug(u"{} Layout :\noffset: {} size: {}", this->GetDebugPathInTree(), - offset, desired_size_); + CRU_LOG_DEBUG(u"{} Layout :\noffset: {} size: {}", + this->GetDebugPathInTree(), offset, desired_size_); } offset_ = offset; size_ = desired_size_; diff --git a/src/ui/render/StackLayoutRenderObject.cpp b/src/ui/render/StackLayoutRenderObject.cpp index fda9a420..9ca9bf02 100644 --- a/src/ui/render/StackLayoutRenderObject.cpp +++ b/src/ui/render/StackLayoutRenderObject.cpp @@ -1,6 +1,6 @@ #include "cru/ui/render/StackLayoutRenderObject.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/ui/render/LayoutHelper.h" #include "cru/ui/render/MeasureRequirement.h" diff --git a/src/ui/render/TextRenderObject.cpp b/src/ui/render/TextRenderObject.cpp index 82f314bd..0b9009c5 100644 --- a/src/ui/render/TextRenderObject.cpp +++ b/src/ui/render/TextRenderObject.cpp @@ -1,7 +1,7 @@ #include "cru/ui/render/TextRenderObject.h" #include "../Helper.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/platform/graphics/Factory.h" #include "cru/platform/graphics/Painter.h" #include "cru/platform/graphics/TextLayout.h" @@ -176,12 +176,11 @@ RenderObject* TextRenderObject::HitTest(const Point& point) { void TextRenderObject::Draw(platform::graphics::IPainter* painter) { if constexpr (debug_flags::draw) { - log::TagDebug(log_tag, - u"Begin to paint, total_offset: {}, size: {}, text_layout: " - u"{}, brush: {}.", - this->GetTotalOffset(), this->GetDesiredSize(), - this->text_layout_->GetDebugString(), - this->brush_->GetDebugString()); + CRU_LOG_DEBUG( + u"Begin to paint, total_offset: {}, size: {}, text_layout: " + u"{}, brush: {}.", + this->GetTotalOffset(), this->GetDesiredSize(), + this->text_layout_->GetDebugString(), this->brush_->GetDebugString()); } if (this->selection_range_.has_value()) { diff --git a/src/win/graphics/direct/Factory.cpp b/src/win/graphics/direct/Factory.cpp index b948c040..e8b3f107 100644 --- a/src/win/graphics/direct/Factory.cpp +++ b/src/win/graphics/direct/Factory.cpp @@ -1,6 +1,6 @@ #include "cru/win/graphics/direct/Factory.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/win/graphics/direct/Brush.h" #include "cru/win/graphics/direct/Exception.h" #include "cru/win/graphics/direct/Font.h" diff --git a/src/win/graphics/direct/TextLayout.cpp b/src/win/graphics/direct/TextLayout.cpp index 14e2d3aa..ffef5e0c 100644 --- a/src/win/graphics/direct/TextLayout.cpp +++ b/src/win/graphics/direct/TextLayout.cpp @@ -1,7 +1,7 @@ #include "cru/win/graphics/direct/TextLayout.h" #include <dwrite.h> -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/platform/Check.h" #include "cru/win/graphics/direct/Exception.h" #include "cru/win/graphics/direct/Factory.h" diff --git a/src/win/gui/Clipboard.cpp b/src/win/gui/Clipboard.cpp index 6bb5d1c5..7ecc9dea 100644 --- a/src/win/gui/Clipboard.cpp +++ b/src/win/gui/Clipboard.cpp @@ -1,6 +1,6 @@ #include "cru/win/gui/Clipboard.h" #include <winuser.h> -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/win/gui/GodWindow.h" #include "cru/win/gui/UiApplication.h" diff --git a/src/win/gui/Cursor.cpp b/src/win/gui/Cursor.cpp index 1d421b59..d85ba565 100644 --- a/src/win/gui/Cursor.cpp +++ b/src/win/gui/Cursor.cpp @@ -1,6 +1,6 @@ #include "cru/win/gui/Cursor.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/win/gui/Exception.h" #include <stdexcept> @@ -16,7 +16,7 @@ WinCursor::~WinCursor() { if (!::DestroyCursor(handle_)) { // This is not a fetal error but might still need notice because it may // cause leak. - log::TagWarn(log_tag, u"Failed to destroy a cursor. Last error code: {}", + CRU_LOG_WARN(u"Failed to destroy a cursor. Last error code: {}", ::GetLastError()); } } diff --git a/src/win/gui/GodWindow.cpp b/src/win/gui/GodWindow.cpp index 0c385bea..4416870f 100644 --- a/src/win/gui/GodWindow.cpp +++ b/src/win/gui/GodWindow.cpp @@ -1,6 +1,6 @@ #include "cru/win/gui/GodWindow.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/win/gui/Exception.h" #include "cru/win/gui/UiApplication.h" #include "cru/win/gui/WindowClass.h" @@ -43,7 +43,7 @@ GodWindow::GodWindow(WinUiApplication* application) { GodWindow::~GodWindow() { if (!::DestroyWindow(hwnd_)) { // Although this could be "safely" ignore. - log::TagWarn(log_tag, u"Failed to destroy god window."); + CRU_LOG_WARN(u"Failed to destroy god window."); } } diff --git a/src/win/gui/InputMethod.cpp b/src/win/gui/InputMethod.cpp index fedb72fe..8a54577b 100644 --- a/src/win/gui/InputMethod.cpp +++ b/src/win/gui/InputMethod.cpp @@ -1,6 +1,6 @@ #include "cru/win/gui/InputMethod.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/common/StringUtil.h" #include "cru/platform/Check.h" #include "cru/platform/gui/DebugFlags.h" @@ -35,7 +35,7 @@ AutoHIMC& AutoHIMC::operator=(AutoHIMC&& other) { AutoHIMC::~AutoHIMC() { if (handle_) { if (!::ImmReleaseContext(hwnd_, handle_)) - log::TagWarn(log_tag, u"Failed to release HIMC."); + CRU_LOG_WARN(u"Failed to release HIMC."); } } @@ -157,7 +157,7 @@ WinInputMethodContext::~WinInputMethodContext() {} void WinInputMethodContext::EnableIME() { const auto hwnd = native_window_->GetWindowHandle(); if (::ImmAssociateContextEx(hwnd, nullptr, IACE_DEFAULT) == FALSE) { - log::TagWarn(log_tag, u"Failed to enable ime."); + CRU_LOG_WARN(u"Failed to enable ime."); } } @@ -168,21 +168,21 @@ void WinInputMethodContext::DisableIME() { ::ImmNotifyIME(himc.Get(), NI_COMPOSITIONSTR, CPS_COMPLETE, 0); if (::ImmAssociateContextEx(hwnd, nullptr, 0) == FALSE) { - log::TagWarn(log_tag, u"Failed to disable ime."); + CRU_LOG_WARN(u"Failed to disable ime."); } } void WinInputMethodContext::CompleteComposition() { auto himc = GetHIMC(); if (!::ImmNotifyIME(himc.Get(), NI_COMPOSITIONSTR, CPS_COMPLETE, 0)) { - log::TagWarn(log_tag, u"Failed to complete composition."); + CRU_LOG_WARN(u"Failed to complete composition."); } } void WinInputMethodContext::CancelComposition() { auto himc = GetHIMC(); if (!::ImmNotifyIME(himc.Get(), NI_COMPOSITIONSTR, CPS_CANCEL, 0)) { - log::TagWarn(log_tag, u"Failed to complete composition."); + CRU_LOG_WARN(u"Failed to complete composition."); } } @@ -201,7 +201,7 @@ void WinInputMethodContext::SetCandidateWindowPosition(const Point& point) { form.ptCurrentPos = native_window_->DipToPixel(point); if (!::ImmSetCandidateWindow(himc.Get(), &form)) - log::TagDebug(log_tag, + CRU_LOG_DEBUG( u"Failed to set input method candidate window position."); } @@ -229,7 +229,7 @@ void WinInputMethodContext::OnWindowNativeMessage( // I don't think this will happen because normal key strike without ime // should only trigger ascci character. If it is a charater from // supplementary planes, it should be handled with ime messages. - log::TagWarn(log_tag, + CRU_LOG_WARN( u"A WM_CHAR message for character from supplementary " u"planes is ignored."); } else { @@ -247,7 +247,7 @@ void WinInputMethodContext::OnWindowNativeMessage( composition_event_.Raise(nullptr); auto composition_text = GetCompositionText(); if constexpr (DebugFlags::input_method) { - log::TagDebug(log_tag, u"WM_IME_COMPOSITION composition text:\n{}", + CRU_LOG_DEBUG(u"WM_IME_COMPOSITION composition text:\n{}", composition_text); } if (message.l_param & GCS_RESULTSTR) { @@ -258,14 +258,14 @@ void WinInputMethodContext::OnWindowNativeMessage( } case WM_IME_STARTCOMPOSITION: { if constexpr (DebugFlags::input_method) { - log::TagDebug(log_tag, u"WM_IME_STARTCOMPOSITION received."); + CRU_LOG_DEBUG(u"WM_IME_STARTCOMPOSITION received."); } composition_start_event_.Raise(nullptr); break; } case WM_IME_ENDCOMPOSITION: { if constexpr (DebugFlags::input_method) { - log::TagDebug(log_tag, u"WM_IME_ENDCOMPOSITION received."); + CRU_LOG_DEBUG(u"WM_IME_ENDCOMPOSITION received."); } composition_end_event_.Raise(nullptr); break; diff --git a/src/win/gui/UiApplication.cpp b/src/win/gui/UiApplication.cpp index 59076a9c..8c2dfae7 100644 --- a/src/win/gui/UiApplication.cpp +++ b/src/win/gui/UiApplication.cpp @@ -2,7 +2,7 @@ #include "TimerManager.h" #include "WindowManager.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/platform/Check.h" #include "cru/win/DebugLogger.h" #include "cru/win/StdOutLogger.h" diff --git a/src/win/gui/Window.cpp b/src/win/gui/Window.cpp index ada3d59f..9c86441e 100644 --- a/src/win/gui/Window.cpp +++ b/src/win/gui/Window.cpp @@ -1,7 +1,7 @@ #include "cru/win/gui/Window.h" #include "WindowManager.h" -#include "cru/common/Logger.h" +#include "cru/common/log/Logger.h" #include "cru/platform/Check.h" #include "cru/platform/graphics/NullPainter.h" #include "cru/platform/gui/Base.h" @@ -207,7 +207,7 @@ bool WinNativeWindow::ReleaseMouse() { void WinNativeWindow::RequestRepaint() { if constexpr (DebugFlags::paint) { - log::TagDebug(log_tag, u"A repaint is requested."); + CRU_LOG_DEBUG(u"A repaint is requested."); } if (!::InvalidateRect(hwnd_, nullptr, FALSE)) throw Win32Error(::GetLastError(), u"Failed to invalidate window."); @@ -234,7 +234,7 @@ void WinNativeWindow::SetCursor(std::shared_ptr<ICursor> cursor) { if (!::SetClassLongPtrW(hwnd_, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(cursor_->GetHandle()))) { - log::TagWarn(log_tag, + CRU_LOG_WARN( u"Failed to set cursor because failed to set class long. Last " u"error code: {}.", ::GetLastError()); @@ -244,8 +244,8 @@ void WinNativeWindow::SetCursor(std::shared_ptr<ICursor> cursor) { if (GetVisibility() != WindowVisibilityType::Show) return; auto lg = [](StringView reason) { - log::TagWarn( - log_tag, + CRU_LOG_WARN( + u"Failed to set cursor because {} when window is visible. (We need to " u"update cursor if it is inside the window.) Last error code: {}.", reason, ::GetLastError()); @@ -507,7 +507,7 @@ void WinNativeWindow::OnPaintInternal() { paint_event_.Raise(nullptr); ValidateRect(hwnd_, nullptr); if constexpr (DebugFlags::paint) { - log::TagDebug(log_tag, u"A repaint is finished."); + CRU_LOG_DEBUG(u"A repaint is finished."); } } |