From d295ce7b0a3885b3cdc97f842693d2f0b613a260 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Tue, 1 Jun 2010 08:21:30 +0000 Subject: [PATCH] Convert a bunch of wxLog* to the new logging method. Originally committed to SVN as r4399. --- aegisub/src/audio_karaoke.cpp | 4 +++- aegisub/src/charset_detect.cpp | 3 ++- aegisub/src/main.cpp | 4 ++++ aegisub/src/spellchecker_hunspell.cpp | 3 ++- aegisub/src/subtitles_provider_libass.cpp | 9 +++++++-- aegisub/src/text_file_reader.cpp | 4 +++- aegisub/src/video_out_gl.cpp | 11 ++++++----- 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/aegisub/src/audio_karaoke.cpp b/aegisub/src/audio_karaoke.cpp index 9ad7b7160..8d2a624a1 100644 --- a/aegisub/src/audio_karaoke.cpp +++ b/aegisub/src/audio_karaoke.cpp @@ -49,6 +49,8 @@ #include #endif +#include + #include "ass_override.h" #include "audio_box.h" #include "audio_display.h" @@ -84,7 +86,7 @@ AudioKaraokeSyllable::AudioKaraokeSyllable(const AssKaraokeSyllable &base) AudioKaraoke::AudioKaraoke(wxWindow *parent) : wxWindow (parent,-1,wxDefaultPosition,wxSize(10,5),wxTAB_TRAVERSAL|wxBORDER_SUNKEN) { - wxLogDebug(_T("AudioKaraoke constructor")); + LOG_D("karaoke") << "Constructor"; enabled = false; splitting = false; split_cursor_syl = -1; diff --git a/aegisub/src/charset_detect.cpp b/aegisub/src/charset_detect.cpp index 34bd7d18f..15552c69b 100644 --- a/aegisub/src/charset_detect.cpp +++ b/aegisub/src/charset_detect.cpp @@ -49,6 +49,7 @@ #endif #include +#include #include "charset_detect.h" #include "text_file_reader.h" @@ -61,7 +62,7 @@ /// @return /// wxString CharSetDetect::GetEncoding(wxString filename) { - wxLogDebug("Filename: %s", filename); + LOG_I("charset/file") << filename; bool unknown = 0; agi::charset::CharsetListDetected list; diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 8a98d916c..d758b29b7 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -75,6 +75,7 @@ #include #include +#include /////////////////// // wxWidgets macro @@ -136,6 +137,9 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { /// @return /// bool AegisubApp::OnInit() { +agi::log::EmitSTDOUT *emit_stdout = new agi::log::EmitSTDOUT(); +emit_stdout->Enable(); + #ifdef __VISUALC__ SetThreadName((DWORD) -1,"AegiMain"); #endif diff --git a/aegisub/src/spellchecker_hunspell.cpp b/aegisub/src/spellchecker_hunspell.cpp index 4845cc386..aa80eda00 100644 --- a/aegisub/src/spellchecker_hunspell.cpp +++ b/aegisub/src/spellchecker_hunspell.cpp @@ -50,6 +50,7 @@ #include #endif +#include #include #include "charset_conv.h" @@ -269,7 +270,7 @@ void HunspellSpellChecker::SetLanguage(wxString language) { dicpath = wxString::Format("%s%s.dic", path, language); usrdicpath = wxString::Format("%s%s.dic", userPath, language); - wxLogDebug("Using dictionary: %ls", dicpath); + LOG_I("dictionary/file") << dicpath; // Check if language is available if (!wxFileExists(affpath) || !wxFileExists(dicpath)) return; diff --git a/aegisub/src/subtitles_provider_libass.cpp b/aegisub/src/subtitles_provider_libass.cpp index e53a71686..56064bea8 100644 --- a/aegisub/src/subtitles_provider_libass.cpp +++ b/aegisub/src/subtitles_provider_libass.cpp @@ -52,6 +52,8 @@ extern "C" { } #endif +#include + #include "ass_file.h" #include "standard_paths.h" #include "subtitles_provider_libass.h" @@ -63,10 +65,13 @@ extern "C" { /// @brief Handle libass messages /// static void msg_callback(int level, const char *fmt, va_list args, void *data) { + char buf[256]; + snprintf(buf, sizeof(buf), fmt, args); + if (level < 2) // warning/error - wxVLogWarning(fmt, args); + LOG_I("subtitle/provider/libass") << buf; else if (level < 7) // verbose - wxVLogDebug(fmt, args); + LOG_D("subtitle/provider/libass") << buf; } diff --git a/aegisub/src/text_file_reader.cpp b/aegisub/src/text_file_reader.cpp index 042bc6c3a..77edc1d06 100644 --- a/aegisub/src/text_file_reader.cpp +++ b/aegisub/src/text_file_reader.cpp @@ -45,6 +45,8 @@ #include #endif +#include + #include "charset_conv.h" #ifdef WITH_UNIVCHARDET #include "charset_detect.h" @@ -78,7 +80,7 @@ wxString TextFileReader::GetEncoding(wxString const& filename) { // Use universalchardet library to detect charset CharSetDetect det; wxString str(det.GetEncoding(filename)); - wxLogDebug("Encoding: %s", str); + LOG_I("file/reader/text/encoding") << str; return str; } diff --git a/aegisub/src/video_out_gl.cpp b/aegisub/src/video_out_gl.cpp index c0ec1c7cc..d69c1cb6b 100644 --- a/aegisub/src/video_out_gl.cpp +++ b/aegisub/src/video_out_gl.cpp @@ -37,11 +37,12 @@ #include "config.h" #ifndef AGI_PRE -#include #include #include #endif +#include + using std::min; using std::max; @@ -85,7 +86,7 @@ static bool TestTexture(int width, int height, GLint format) { glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format); while (glGetError()) { } // Silently swallow all errors as we don't care why it failed if it did - wxLogDebug(L"VideoOutGL::TestTexture: %dx%d\n", width, height); + LOG_I("video/out/gl") << "VideoOutGL::TestTexture: " << width << "x" << height; return format != 0; } @@ -116,7 +117,7 @@ void VideoOutGL::DetectOpenGLCapabilities() { // Test for the maximum supported texture size glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); while (maxTextureSize > 64 && !TestTexture(maxTextureSize, maxTextureSize, internalFormat)) maxTextureSize >>= 1; - wxLogDebug(L"VideoOutGL::DetectOpenGLCapabilities: Maximum texture size is %dx%d\n", maxTextureSize, maxTextureSize); + LOG_I("video/out/gl") << "Maximum texture size is " << maxTextureSize << "x" << maxTextureSize; // Test for rectangular texture support supportsRectangularTextures = TestTexture(maxTextureSize, maxTextureSize >> 1, internalFormat); @@ -136,7 +137,7 @@ void VideoOutGL::InitTextures(int width, int height, GLenum format, int bpp, boo frameWidth = width; frameHeight = height; frameFormat = format; - wxLogDebug(L"VideoOutGL::InitTextures: Video size: %dx%d\n", width, height); + LOG_I("video/out/gl") << "Video size: " << width << "x" << height; DetectOpenGLCapabilities(); @@ -269,7 +270,7 @@ void VideoOutGL::InitTextures(int width, int height, GLenum format, int bpp, boo for (int i = 0; i < textureCount; ++i) { CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, textureIdList[i])); CHECK_INIT_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, textureSizes[i].first, textureSizes[i].second, 0, format, GL_UNSIGNED_BYTE, NULL)); - wxLogDebug(L"VideoOutGL::InitTextures: Using texture size: %dx%d\n", textureSizes[i].first, textureSizes[i].second); + LOG_I("video/out/gl") << "Using texture size: " << textureSizes[i].first << "x" << textureSizes[i].second; CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP));