Convert a bunch of wxLog* to the new logging method.

Originally committed to SVN as r4399.
This commit is contained in:
Amar Takhar 2010-06-01 08:21:30 +00:00
parent 798e18490d
commit d295ce7b0a
7 changed files with 27 additions and 11 deletions

View file

@ -49,6 +49,8 @@
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#endif #endif
#include <libaegisub/log.h>
#include "ass_override.h" #include "ass_override.h"
#include "audio_box.h" #include "audio_box.h"
#include "audio_display.h" #include "audio_display.h"
@ -84,7 +86,7 @@ AudioKaraokeSyllable::AudioKaraokeSyllable(const AssKaraokeSyllable &base)
AudioKaraoke::AudioKaraoke(wxWindow *parent) AudioKaraoke::AudioKaraoke(wxWindow *parent)
: wxWindow (parent,-1,wxDefaultPosition,wxSize(10,5),wxTAB_TRAVERSAL|wxBORDER_SUNKEN) : wxWindow (parent,-1,wxDefaultPosition,wxSize(10,5),wxTAB_TRAVERSAL|wxBORDER_SUNKEN)
{ {
wxLogDebug(_T("AudioKaraoke constructor")); LOG_D("karaoke") << "Constructor";
enabled = false; enabled = false;
splitting = false; splitting = false;
split_cursor_syl = -1; split_cursor_syl = -1;

View file

@ -49,6 +49,7 @@
#endif #endif
#include <libaegisub/charset.h> #include <libaegisub/charset.h>
#include <libaegisub/log.h>
#include "charset_detect.h" #include "charset_detect.h"
#include "text_file_reader.h" #include "text_file_reader.h"
@ -61,7 +62,7 @@
/// @return /// @return
/// ///
wxString CharSetDetect::GetEncoding(wxString filename) { wxString CharSetDetect::GetEncoding(wxString filename) {
wxLogDebug("Filename: %s", filename); LOG_I("charset/file") << filename;
bool unknown = 0; bool unknown = 0;
agi::charset::CharsetListDetected list; agi::charset::CharsetListDetected list;

View file

@ -75,6 +75,7 @@
#include <libaegisub/io.h> #include <libaegisub/io.h>
#include <libaegisub/access.h> #include <libaegisub/access.h>
#include <libaegisub/log.h>
/////////////////// ///////////////////
// wxWidgets macro // wxWidgets macro
@ -136,6 +137,9 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) {
/// @return /// @return
/// ///
bool AegisubApp::OnInit() { bool AegisubApp::OnInit() {
agi::log::EmitSTDOUT *emit_stdout = new agi::log::EmitSTDOUT();
emit_stdout->Enable();
#ifdef __VISUALC__ #ifdef __VISUALC__
SetThreadName((DWORD) -1,"AegiMain"); SetThreadName((DWORD) -1,"AegiMain");
#endif #endif

View file

@ -50,6 +50,7 @@
#include <wx/wfstream.h> #include <wx/wfstream.h>
#endif #endif
#include <libaegisub/log.h>
#include <hunspell/hunspell.hxx> #include <hunspell/hunspell.hxx>
#include "charset_conv.h" #include "charset_conv.h"
@ -269,7 +270,7 @@ void HunspellSpellChecker::SetLanguage(wxString language) {
dicpath = wxString::Format("%s%s.dic", path, language); dicpath = wxString::Format("%s%s.dic", path, language);
usrdicpath = wxString::Format("%s%s.dic", userPath, language); usrdicpath = wxString::Format("%s%s.dic", userPath, language);
wxLogDebug("Using dictionary: %ls", dicpath); LOG_I("dictionary/file") << dicpath;
// Check if language is available // Check if language is available
if (!wxFileExists(affpath) || !wxFileExists(dicpath)) return; if (!wxFileExists(affpath) || !wxFileExists(dicpath)) return;

View file

@ -52,6 +52,8 @@ extern "C" {
} }
#endif #endif
#include <libaegisub/log.h>
#include "ass_file.h" #include "ass_file.h"
#include "standard_paths.h" #include "standard_paths.h"
#include "subtitles_provider_libass.h" #include "subtitles_provider_libass.h"
@ -63,10 +65,13 @@ extern "C" {
/// @brief Handle libass messages /// @brief Handle libass messages
/// ///
static void msg_callback(int level, const char *fmt, va_list args, void *data) { 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 if (level < 2) // warning/error
wxVLogWarning(fmt, args); LOG_I("subtitle/provider/libass") << buf;
else if (level < 7) // verbose else if (level < 7) // verbose
wxVLogDebug(fmt, args); LOG_D("subtitle/provider/libass") << buf;
} }

View file

@ -45,6 +45,8 @@
#include <string> #include <string>
#endif #endif
#include <libaegisub/log.h>
#include "charset_conv.h" #include "charset_conv.h"
#ifdef WITH_UNIVCHARDET #ifdef WITH_UNIVCHARDET
#include "charset_detect.h" #include "charset_detect.h"
@ -78,7 +80,7 @@ wxString TextFileReader::GetEncoding(wxString const& filename) {
// Use universalchardet library to detect charset // Use universalchardet library to detect charset
CharSetDetect det; CharSetDetect det;
wxString str(det.GetEncoding(filename)); wxString str(det.GetEncoding(filename));
wxLogDebug("Encoding: %s", str); LOG_I("file/reader/text/encoding") << str;
return str; return str;
} }

View file

@ -37,11 +37,12 @@
#include "config.h" #include "config.h"
#ifndef AGI_PRE #ifndef AGI_PRE
#include <wx/log.h>
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#endif #endif
#include <libaegisub/log.h>
using std::min; using std::min;
using std::max; 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); 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 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; return format != 0;
} }
@ -116,7 +117,7 @@ void VideoOutGL::DetectOpenGLCapabilities() {
// Test for the maximum supported texture size // Test for the maximum supported texture size
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
while (maxTextureSize > 64 && !TestTexture(maxTextureSize, maxTextureSize, internalFormat)) maxTextureSize >>= 1; 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 // Test for rectangular texture support
supportsRectangularTextures = TestTexture(maxTextureSize, maxTextureSize >> 1, internalFormat); supportsRectangularTextures = TestTexture(maxTextureSize, maxTextureSize >> 1, internalFormat);
@ -136,7 +137,7 @@ void VideoOutGL::InitTextures(int width, int height, GLenum format, int bpp, boo
frameWidth = width; frameWidth = width;
frameHeight = height; frameHeight = height;
frameFormat = format; frameFormat = format;
wxLogDebug(L"VideoOutGL::InitTextures: Video size: %dx%d\n", width, height); LOG_I("video/out/gl") << "Video size: " << width << "x" << height;
DetectOpenGLCapabilities(); DetectOpenGLCapabilities();
@ -269,7 +270,7 @@ void VideoOutGL::InitTextures(int width, int height, GLenum format, int bpp, boo
for (int i = 0; i < textureCount; ++i) { for (int i = 0; i < textureCount; ++i) {
CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, textureIdList[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)); 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_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_MAG_FILTER, GL_LINEAR));
CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)); CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP));