Changes in LOG/TRACE messages

This commit is contained in:
David Capello 2016-10-27 12:25:33 -03:00
parent c789e4a872
commit cc18334c5a
32 changed files with 127 additions and 145 deletions

View File

@ -192,7 +192,7 @@ void App::initialize(const AppOptions& options)
FileFormatsManager::instance()->registerAllFormats();
if (isPortable())
LOG("Running in portable mode\n");
LOG("APP: Running in portable mode\n");
// Load or create the default palette, or migrate the default
// palette from an old format palette to the new one, etc.
@ -201,7 +201,7 @@ void App::initialize(const AppOptions& options)
// Initialize GUI interface
UIContext* ctx = UIContext::instance();
if (isGui()) {
LOG("GUI mode\n");
LOG("APP: GUI mode\n");
// Setup the GUI cursor and redraw screen
@ -229,7 +229,7 @@ void App::initialize(const AppOptions& options)
}
// Procress options
LOG("Processing options...\n");
LOG("APP: Processing options...\n");
bool ignoreEmpty = false;
bool trim = false;
@ -636,7 +636,7 @@ void App::initialize(const AppOptions& options)
// Export
if (m_exporter) {
LOG("Exporting sheet...\n");
LOG("APP: Exporting sheet...\n");
if (sheetType != SpriteSheetType::None)
m_exporter->setSpriteSheetType(sheetType);
@ -650,7 +650,7 @@ void App::initialize(const AppOptions& options)
base::UniquePtr<Document> spriteSheet(m_exporter->exportSheet());
m_exporter.reset(NULL);
LOG("Export sprite sheet: Done\n");
LOG("APP: Export sprite sheet: Done\n");
}
she::instance()->finishLaunching();
@ -736,11 +736,9 @@ void App::run()
App::~App()
{
try {
LOG("APP: Exit\n");
ASSERT(m_instance == this);
// Remove Aseprite handlers
LOG("ASE: Uninstalling\n");
// Delete file formats.
FileFormatsManager::destroyInstance();
@ -764,12 +762,13 @@ App::~App()
m_instance = NULL;
}
catch (const std::exception& e) {
LOG(ERROR) << "APP: Error: " << e.what() << "\n";
she::error_message(e.what());
// no re-throw
}
catch (...) {
she::error_message("Error closing ASE.\n(uncaught exception)");
she::error_message("Error closing " PACKAGE ".\n(uncaught exception)");
// no re-throw
}

View File

@ -185,7 +185,7 @@ AppBrushes::AppBrushes()
load(fn);
}
catch (const std::exception& ex) {
LOG("Error loading user brushes: %s", ex.what());
LOG(ERROR) << "BRSH: Error loading user brushes: " << ex.what() << "\n";
}
}

View File

@ -71,7 +71,7 @@ void AppMenus::reload()
////////////////////////////////////////
// Load menus
LOG(" - Loading menus from \"%s\"...\n", path);
LOG("MENU: Loading menus from %s\n", path);
m_rootMenu.reset(loadMenuById(handle, "main_menu"));
@ -81,7 +81,7 @@ void AppMenus::reload()
m_rootMenu->insertChild(0, createInvalidVersionMenuitem());
#endif
LOG("Main menu loaded.\n");
LOG("MENU: Main menu loaded.\n");
m_tabPopupMenu.reset(loadMenuById(handle, "tab_popup"));
m_documentTabPopupMenu.reset(loadMenuById(handle, "document_tab_popup"));
@ -96,7 +96,7 @@ void AppMenus::reload()
////////////////////////////////////////
// Load keyboard shortcuts for commands
LOG(" - Loading commands keyboard shortcuts from \"%s\"...\n", path);
LOG("MENU: Loading commands keyboard shortcuts from %s\n", path);
TiXmlElement* xmlKey = handle
.FirstChild("gui")
@ -167,8 +167,6 @@ Menu* AppMenus::loadMenuById(TiXmlHandle& handle, const char* id)
{
ASSERT(id != NULL);
//LOG("loadMenuById(%s)\n", id);
// <gui><menus><menu>
TiXmlElement* xmlMenu = handle
.FirstChild("gui")
@ -190,8 +188,6 @@ Menu* AppMenus::convertXmlelemToMenu(TiXmlElement* elem)
{
Menu* menu = new Menu();
//LOG("convertXmlelemToMenu(%s, %s, %s)\n", elem->Value(), elem->Attribute("id"), elem->Attribute("text"));
TiXmlElement* child = elem->FirstChildElement();
while (child) {
Widget* menuitem = convertXmlelemToMenuitem(child);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -27,7 +27,7 @@ Cmd::~Cmd()
void Cmd::execute(Context* ctx)
{
TRACE("Cmd: Executing cmd '%s'\n", typeid(*this).name());
TRACE("CMD: Executing cmd '%s'\n", typeid(*this).name());
ASSERT(m_state == State::NotExecuted);
m_ctx = ctx;
@ -42,7 +42,7 @@ void Cmd::execute(Context* ctx)
void Cmd::undo()
{
TRACE("Cmd: Undo cmd '%s'\n", typeid(*this).name());
TRACE("CMD: Undo cmd '%s'\n", typeid(*this).name());
ASSERT(m_state == State::Executed || m_state == State::Redone);
onUndo();
@ -55,7 +55,7 @@ void Cmd::undo()
void Cmd::redo()
{
TRACE("Cmd: Redo cmd '%s'\n", typeid(*this).name());
TRACE("CMD: Redo cmd '%s'\n", typeid(*this).name());
ASSERT(m_state == State::Undone);
onRedo();

View File

@ -60,7 +60,7 @@ void Context::executeCommand(Command* command, const Params& params)
ASSERT(command != NULL);
LOG("Context: Executing command '%s'...\n", command->id().c_str());
LOG(VERBOSE) << "CTXT: Executing command " << command->id() << "\n";
try {
m_flags.update(this);
@ -70,14 +70,14 @@ void Context::executeCommand(Command* command, const Params& params)
BeforeCommandExecution(ev);
if (ev.isCanceled()) {
LOG("Context: '%s' was canceled/simulated.\n", command->id().c_str());
LOG(VERBOSE) << "CTXT: Command " << command->id() << " was canceled/simulated.\n";
}
else if (command->isEnabled(this)) {
command->execute(this);
LOG("Context: '%s' executed successfully\n", command->id().c_str());
LOG(VERBOSE) << "CTXT: Command " << command->id() << " executed successfully\n";
}
else {
LOG("Context: '%s' is disabled\n", command->id().c_str());
LOG(VERBOSE) << "CTXT: Command " << command->id() << " is disabled\n";
}
AfterCommandExecution(ev);
@ -87,21 +87,20 @@ void Context::executeCommand(Command* command, const Params& params)
app_rebuild_documents_tabs();
}
catch (base::Exception& e) {
LOG("Context: Exception caught executing '%s' command\n%s\n",
command->id().c_str(), e.what());
LOG(ERROR) << "CTXT: Exception caught executing " << command->id() << " command\n"
<< e.what() << "\n";
Console::showException(e);
}
catch (std::exception& e) {
LOG("Context: std::exception caught executing '%s' command\n%s\n",
command->id().c_str(), e.what());
LOG(ERROR) << "CTXT: std::exception caught executing " << command->id() << " command\n"
<< e.what() << "\n";
console.printf("An error ocurred executing the command.\n\nDetails:\n%s", e.what());
}
#ifdef NDEBUG
catch (...) {
LOG("Context: Unknown exception executing '%s' command\n",
command->id().c_str());
LOG(ERROR) << "CTXT: Unknown exception executing " << command->id() << " command\n";
console.printf("An unknown error ocurred executing the command.\n"
"Please save your work, close the program, try it\n"

View File

@ -47,14 +47,14 @@ void BackupObserver::stop()
void BackupObserver::onAddDocument(doc::Document* document)
{
TRACE("DataRecovery: Observe document %p\n", document);
TRACE("RECO: Observe document %p\n", document);
base::scoped_lock hold(m_mutex);
m_documents.push_back(static_cast<app::Document*>(document));
}
void BackupObserver::onRemoveDocument(doc::Document* document)
{
TRACE("DataRecovery:: Remove document %p\n", document);
TRACE("RECO:: Remove document %p\n", document);
{
base::scoped_lock hold(m_mutex);
base::remove_from_container(m_documents, static_cast<app::Document*>(document));
@ -77,7 +77,7 @@ void BackupObserver::backgroundThread()
while (!m_done) {
seconds++;
if (seconds >= waitUntil) {
TRACE("DataRecovery: Start backup process for %d documents\n", m_documents.size());
TRACE("RECO: Start backup process for %d documents\n", m_documents.size());
base::scoped_lock hold(m_mutex);
base::Chrono chrono;
@ -89,7 +89,7 @@ void BackupObserver::backgroundThread()
m_session->saveDocumentChanges(doc);
}
catch (const std::exception&) {
TRACE("DataRecovery: Document '%d' is locked\n", doc->id());
TRACE("RECO: Document '%d' is locked\n", doc->id());
somethingLocked = true;
}
}
@ -97,7 +97,7 @@ void BackupObserver::backgroundThread()
seconds = 0;
waitUntil = (somethingLocked ? lockedPeriod: normalPeriod);
TRACE("DataRecovery: Backup process done (%.16g)\n", chrono.elapsed());
TRACE("RECO: Backup process done (%.16g)\n", chrono.elapsed());
}
base::this_thread::sleep_for(1.0);
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -29,11 +29,11 @@ DataRecovery::DataRecovery(doc::Context* ctx)
std::string sessionsDir = rf.getFirstOrCreateDefault();
// Existent sessions
TRACE("DataRecovery: Listing sessions from '%s'\n", sessionsDir.c_str());
TRACE("RECO: Listing sessions from '%s'\n", sessionsDir.c_str());
for (auto& itemname : base::list_files(sessionsDir)) {
std::string itempath = base::join_path(sessionsDir, itemname);
if (base::is_directory(itempath)) {
TRACE("- Session '%s' ", itempath.c_str());
TRACE("RECO: Session '%s' ", itempath.c_str());
SessionPtr session(new Session(itempath));
if (!session->isRunning()) {
@ -75,7 +75,7 @@ DataRecovery::DataRecovery(doc::Context* ctx)
m_inProgress.reset(new Session(newSessionDir));
m_inProgress->create(pid);
TRACE("DataRecovery: Session in progress '%s'\n", newSessionDir.c_str());
TRACE("RECO: Session in progress '%s'\n", newSessionDir.c_str());
m_backup = new BackupObserver(m_inProgress.get(), ctx);
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -140,7 +140,7 @@ private:
if (!ver)
continue;
TRACE(" - Restoring %s #%d v%d\n", prefix, id, ver);
TRACE("RECO: Restoring %s #%d v%d\n", prefix, id, ver);
std::string fn = prefix;
fn.push_back('-');
@ -154,11 +154,11 @@ private:
obj = (this->*readMember)(s);
if (obj) {
TRACE(" - %s #%d v%d restored successfully\n", prefix, id, ver);
TRACE("RECO: %s #%d v%d restored successfully\n", prefix, id, ver);
return obj;
}
else {
TRACE(" - %s #%d v%d was not restored\n", prefix, id, ver);
TRACE("RECO: %s #%d v%d was not restored\n", prefix, id, ver);
}
}

View File

@ -123,8 +123,8 @@ void Session::removeFromDisk()
}
catch (const std::exception& ex) {
(void)ex;
TRACE("Session directory cannot be removed, it's not empty\nError: '%s'\n",
ex.what());
LOG(ERROR) << "RECO: Session directory cannot be removed, it's not empty.\n"
<< " Error: " << ex.what() << "\n";
}
}
@ -134,7 +134,7 @@ void Session::saveDocumentChanges(app::Document* doc)
app::Context ctx;
std::string dir = base::join_path(m_path,
base::convert_to<std::string>(doc->id()));
TRACE("DataRecovery: Saving document '%s'...\n", dir.c_str());
TRACE("RECO: Saving document '%s'...\n", dir.c_str());
if (!base::is_directory(dir))
base::make_directory(dir);
@ -237,7 +237,7 @@ void Session::deleteDirectory(const std::string& dir)
for (auto& item : base::list_files(dir)) {
std::string objfn = base::join_path(dir, item);
if (base::is_file(objfn)) {
TRACE("DataRecovery: Deleting file '%s'\n", objfn.c_str());
TRACE("RECO: Deleting file '%s'\n", objfn.c_str());
base::delete_file(objfn);
}
}

View File

@ -465,7 +465,7 @@ bool Document::lock(LockType lockType, int timeout)
m_write_lock = true;
#ifdef DEBUG_DOCUMENT_LOCKS
TRACE("Document::lock: Locked <%d> to write\n", id());
TRACE("DOC: Document::lock: Locked <%d> to write\n", id());
#endif
return true;
}
@ -479,7 +479,7 @@ bool Document::lock(LockType lockType, int timeout)
timeout -= delay;
#ifdef DEBUG_DOCUMENT_LOCKS
TRACE("Document::lock: wait 100 msecs for <%d>\n", id());
TRACE("DOC: Document::lock: wait 100 msecs for <%d>\n", id());
#endif
base::this_thread::sleep_for(double(delay) / 1000.0);
@ -489,7 +489,7 @@ bool Document::lock(LockType lockType, int timeout)
}
#ifdef DEBUG_DOCUMENT_LOCKS
TRACE("Document::lock: Cannot lock <%d> to %s (has %d read locks and %d write locks)\n",
TRACE("DOC: Document::lock: Cannot lock <%d> to %s (has %d read locks and %d write locks)\n",
id(), (lockType == ReadLock ? "read": "write"), m_read_locks, m_write_lock);
#endif
@ -508,7 +508,7 @@ bool Document::lockToWrite(int timeout)
m_write_lock = true;
#ifdef DEBUG_DOCUMENT_LOCKS
TRACE("Document::lockToWrite: Locked <%d> to write\n", id());
TRACE("DOC: Document::lockToWrite: Locked <%d> to write\n", id());
#endif
return true;
@ -520,7 +520,7 @@ bool Document::lockToWrite(int timeout)
timeout -= delay;
#ifdef DEBUG_DOCUMENT_LOCKS
TRACE("Document::lockToWrite: wait 100 msecs for <%d>\n", id());
TRACE("DOC: Document::lockToWrite: wait 100 msecs for <%d>\n", id());
#endif
base::this_thread::sleep_for(double(delay) / 1000.0);
@ -530,7 +530,7 @@ bool Document::lockToWrite(int timeout)
}
#ifdef DEBUG_DOCUMENT_LOCKS
TRACE("Document::lockToWrite: Cannot lock <%d> to write (has %d read locks and %d write locks)\n",
TRACE("DOC: Document::lockToWrite: Cannot lock <%d> to write (has %d read locks and %d write locks)\n",
id(), m_read_locks, m_write_lock);
#endif

View File

@ -128,7 +128,7 @@ FileOp* FileOp::createLoadDocumentOperation(Context* context, const char* filena
if (!fop)
return nullptr;
LOG("Loading file \"%s\"\n", filename);
LOG("FILE: Loading file \"%s\"\n", filename);
// Does file exist?
if (!base::is_file(filename)) {
@ -226,7 +226,7 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
fop->m_document = const_cast<Document*>(document);
// Get the extension of the filename (in lower case)
LOG("Saving document \"%s\"\n", filename);
LOG("FILE: Saving document \"%s\"\n", filename);
// Get the format through the extension of the filename
fop->m_format = FileFormatsManager::instance()->getFileFormat(

View File

@ -189,8 +189,8 @@ public:
, m_remap(256)
, m_hasLocalColormaps(false)
, m_firstLocalColormap(nullptr) {
TRACE("[GifDecoder] GIF background index=%d\n", (int)m_gifFile->SBackGroundColor);
TRACE("[GifDecoder] GIF global colormap=%d, ncolors=%d\n",
TRACE("GIF: background index=%d\n", (int)m_gifFile->SBackGroundColor);
TRACE("GIF: global colormap=%d, ncolors=%d\n",
(m_gifFile->SColorMap ? 1: 0),
(m_gifFile->SColorMap ? m_gifFile->SColorMap->ColorCount: 0));
}
@ -310,7 +310,7 @@ private:
UniquePtr<Image> frameImage(
readFrameIndexedImage(frameBounds));
TRACE("[GifDecoder] Frame[%d] transparent index = %d\n", (int)m_frameNum, m_localTransparentIndex);
TRACE("GIF: Frame[%d] transparent index = %d\n", (int)m_frameNum, m_localTransparentIndex);
if (m_frameNum == 0) {
if (m_localTransparentIndex >= 0)
@ -325,7 +325,7 @@ private:
// Convert the sprite to RGB if we have more than 256 colors
if ((m_sprite->pixelFormat() == IMAGE_INDEXED) &&
(m_sprite->palette(m_frameNum)->size() > 256)) {
TRACE("[GifDecoder] Converting to RGB because we have %d colors\n",
TRACE("GIF: Converting to RGB because we have %d colors\n",
m_sprite->palette(m_frameNum)->size());
convertIndexedSpriteToRgb();
@ -444,7 +444,7 @@ private:
int ncolors = colormap->ColorCount;
bool isLocalColormap = (m_gifFile->Image.ColorMap ? true: false);
TRACE("[GifDecoder] Local colormap=%d, ncolors=%d\n", isLocalColormap, ncolors);
TRACE("GIF: Local colormap=%d, ncolors=%d\n", isLocalColormap, ncolors);
// We'll calculate the list of used colormap indexes in this
// frameImage.
@ -527,7 +527,7 @@ private:
// Number of colors in the image that aren't in the palette.
int missing = (usedNColors - found);
TRACE("[GifDecoder] Bg index=%d,\n"
TRACE("GIF: Bg index=%d,\n"
" Local transparent index=%d,\n"
" Need extra index to show bg color=%d,\n "
" Found colors in palette=%d,\n"
@ -645,7 +645,7 @@ private:
m_localTransparentIndex = (extension[1] & 1) ? extension[4]: -1;
m_frameDelay = (extension[3] << 8) | extension[2];
TRACE("[GifDecoder] Disposal method: %d\n Transparent index: %d\n Frame delay: %d\n",
TRACE("GIF: Disposal method: %d\n Transparent index: %d\n Frame delay: %d\n",
m_disposalMethod, m_localTransparentIndex, m_frameDelay);
}
}
@ -1046,7 +1046,7 @@ private:
}
}
TRACE("[GifEncoder] frameBounds=%d %d %d %d prev=%d %d %d %d next=%d %d %d %d\n",
TRACE("GIF: frameBounds=%d %d %d %d prev=%d %d %d %d next=%d %d %d %d\n",
frameBounds.x, frameBounds.y, frameBounds.w, frameBounds.h,
prev.x, prev.y, prev.w, prev.h,
next.x, next.y, next.w, next.h);

View File

@ -89,7 +89,7 @@ static void output_message(j_common_ptr cinfo)
(*cinfo->err->format_message)(cinfo, buffer);
// Put in the log file if.
LOG("JPEG library: \"%s\"\n", buffer);
LOG(ERROR) << "JPEG: \"" << buffer << "\"\n";
// Leave the message for the application.
((struct error_mgr *)cinfo->err)->fop->setError("%s\n", buffer);

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -164,13 +164,10 @@ FileSystemModule::FileSystemModule()
// get the root element of the file system (this will create
// the 'rootitem' FileItem)
getRootFileItem();
LOG("File system module installed\n");
}
FileSystemModule::~FileSystemModule()
{
LOG("File system module: uninstalling\n");
ASSERT(m_instance == this);
for (FileItemMap::iterator
@ -197,7 +194,6 @@ FileSystemModule::~FileSystemModule()
delete fileitems_map;
delete thumbnail_map;
LOG("File system module: uninstalled\n");
m_instance = NULL;
}
@ -564,7 +560,7 @@ FileItem::FileItem(FileItem* parent)
FileItem::~FileItem()
{
LOG("FS: Destroying FileItem() with parent %p\n", m_parent);
TRACE("FS: Destroying FileItem() with parent %p\n", m_parent);
#ifdef _WIN32
if (m_fullpidl && m_fullpidl != m_pidl) {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -28,7 +28,7 @@ GuiXml* GuiXml::instance()
GuiXml::GuiXml()
{
LOG("Loading gui.xml file...\n");
LOG("GUIXML: Loading gui.xml file\n");
ResourceFinder rf;
rf.includeDataDir("gui.xml");

View File

@ -31,7 +31,7 @@ LoggerModule::LoggerModule(bool createLogInDesktop)
LoggerModule::~LoggerModule()
{
LOG("Logger module: shutting down (this is the last line)\n");
LOG("LOG: Done\n");
// Close log file
base::set_log_filename("");

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -41,7 +41,7 @@ LegacyModules::LegacyModules(int requirements)
{
for (int c=0; c<modules; c++)
if ((module[c].reqs & requirements) == module[c].reqs) {
LOG("Installing module: %s\n", module[c].name);
LOG("MODS: Installing module: %s\n", module[c].name);
if ((*module[c].init)() < 0)
throw base::Exception("Error initializing module: %s",
@ -55,7 +55,7 @@ LegacyModules::~LegacyModules()
{
for (int c=modules-1; c>=0; c--)
if (module[c].installed) {
LOG("Unstalling module: %s\n", module[c].name);
LOG("MODS: Unstalling module: %s\n", module[c].name);
(*module[c].exit)();
module[c].installed = false;
}

View File

@ -48,7 +48,7 @@ void HttpLoader::threadHttpRequest()
try {
base::ScopedValue<bool> scoped(m_done, false, true);
LOG("Sending http request to %s...\n", m_url.c_str());
LOG("HTTP: Sending http request to %s\n", m_url.c_str());
std::string dir = base::join_path(base::get_temp_path(), PACKAGE);
base::make_all_directories(dir);
@ -68,13 +68,13 @@ void HttpLoader::threadHttpRequest()
m_filename = fn;
}
LOG("Response: %d\n", response.status());
LOG("HTTP: Response: %d\n", response.status());
}
catch (const std::exception& e) {
LOG("Unexpected exception sending http request: '%s'\n", e.what());
LOG(ERROR) << "HTTP: Unexpected exception sending http request: " << e.what() << "\n";
}
catch (...) {
LOG("Unexpected unknown exception sending http request\n");
LOG(ERROR) << "HTTP: Unexpected unknown exception sending http request\n";
}
delete m_request;

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -27,14 +27,11 @@ ResourcesLoader::ResourcesLoader(ResourcesLoaderDelegate* delegate)
, m_cancel(false)
, m_thread(base::Bind<void>(&ResourcesLoader::threadLoadResources, this))
{
LOG("ResourcesLoader::ResourcesLoader()\n");
}
ResourcesLoader::~ResourcesLoader()
{
m_thread.join();
LOG("ResourcesLoader::~ResourcesLoader()\n");
}
void ResourcesLoader::cancel()
@ -55,12 +52,10 @@ bool ResourcesLoader::next(base::UniquePtr<Resource>& resource)
void ResourcesLoader::threadLoadResources()
{
LOG("threadLoadResources()\n");
base::ScopedValue<bool> scoped(m_done, false, true);
std::string path = m_delegate->resourcesLocation();
LOG("Loading resources from %s...\n", path.c_str());
TRACE("RESLOAD: Loading resources from %s...\n", path.c_str());
if (path.empty())
return;

View File

@ -57,7 +57,7 @@ bool ResourceFinder::findFirst()
{
while (next()) {
if (m_log)
LOG("Searching file \"%s\"...", filename().c_str());
LOG("FIND: \"%s\"", filename().c_str());
if (base::is_file(filename())) {
if (m_log)
@ -142,7 +142,7 @@ void ResourceFinder::includeHomeDir(const char* filename)
addPath(buf);
}
else {
LOG("You don't have set $HOME variable\n");
LOG("FIND: You don't have set $HOME variable\n");
addPath(filename);
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -81,8 +81,6 @@ const char* WellKnownPointShapes::Spray = "spray";
ToolBox::ToolBox()
{
LOG("Toolbox module: installing\n");
m_inks[WellKnownInks::Selection] = new SelectionInk();
m_inks[WellKnownInks::Paint] = new PaintInk(PaintInk::Simple);
m_inks[WellKnownInks::PaintFg] = new PaintInk(PaintInk::WithFg);
@ -122,8 +120,6 @@ ToolBox::ToolBox()
m_intertwiners[WellKnownIntertwiners::AsPixelPerfect] = new IntertwineAsPixelPerfect();
loadTools();
LOG("Toolbox module: installed\n");
}
struct deleter {
@ -136,16 +132,12 @@ struct deleter {
ToolBox::~ToolBox()
{
LOG("Toolbox module: uninstalling\n");
std::for_each(m_tools.begin(), m_tools.end(), deleter());
std::for_each(m_groups.begin(), m_groups.end(), deleter());
std::for_each(m_intertwiners.begin(), m_intertwiners.end(), deleter());
std::for_each(m_pointshapers.begin(), m_pointshapers.end(), deleter());
std::for_each(m_controllers.begin(), m_controllers.end(), deleter());
std::for_each(m_inks.begin(), m_inks.end(), deleter());
LOG("Toolbox module: uninstalled\n");
}
Tool* ToolBox::getToolById(const std::string& id)
@ -155,9 +147,7 @@ Tool* ToolBox::getToolById(const std::string& id)
if (tool->getId() == id)
return tool;
}
// LOG("Error get_tool_by_name() with '%s'\n", name.c_str());
// ASSERT(false);
return NULL;
return nullptr;
}
Ink* ToolBox::getInkById(const std::string& id)
@ -177,7 +167,7 @@ PointShape* ToolBox::getPointShapeById(const std::string& id)
void ToolBox::loadTools()
{
LOG("Loading Aseprite tools\n");
LOG("TOOL: Loading tools...\n");
XmlDocumentRef doc(GuiXml::instance()->doc());
TiXmlHandle handle(doc.get());
@ -188,11 +178,11 @@ void ToolBox::loadTools()
const char* group_id = xmlGroup->Attribute("id");
const char* group_text = xmlGroup->Attribute("text");
LOG(" - New group '%s'\n", group_id);
if (!group_id || !group_text)
throw base::Exception("The configuration file has a <group> without 'id' or 'text' attributes.");
LOG(VERBOSE) << "TOOL: Group " << group_id << "\n";
ToolGroup* tool_group = new ToolGroup(group_id, group_text);
// For each tool
@ -207,7 +197,7 @@ void ToolBox::loadTools()
Tool* tool = new Tool(tool_group, tool_id, tool_text, tool_tips,
default_brush_size ? strtol(default_brush_size, NULL, 10): 1);
LOG(" - New tool '%s' in group '%s' found\n", tool_id, group_id);
LOG(VERBOSE) << "TOOL: Tool " << tool_id << " in group " << group_id << " found\n";
loadToolProperties(xmlTool, tool, 0, "left");
loadToolProperties(xmlTool, tool, 1, "right");
@ -220,6 +210,8 @@ void ToolBox::loadTools()
m_groups.push_back(tool_group);
xmlGroup = xmlGroup->NextSiblingElement();
}
LOG("TOOL: Done. %d tools, %d groups.\n", m_tools.size(), m_groups.size());
}
void ToolBox::loadToolProperties(TiXmlElement* xmlTool, Tool* tool, int button, const std::string& suffix)

View File

@ -144,7 +144,7 @@ void MovingPixelsState::onEnterState(Editor* editor)
EditorState::LeaveAction MovingPixelsState::onLeaveState(Editor* editor, EditorState* newState)
{
LOG("MovingPixels: leave state\n");
TRACE("MOVPIXS: onLeaveState\n");
ASSERT(m_pixelsMovement);
ASSERT(editor == m_editor);
@ -481,7 +481,7 @@ void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
{
Command* command = ev.command();
LOG("MovingPixelsState::onBeforeCommandExecution %s\n", command->id().c_str());
TRACE("MOVPIXS: onBeforeCommandExecution %s\n", command->id().c_str());
// If the command is for other editor, we don't drop pixels.
if (!isActiveEditor())
@ -637,7 +637,7 @@ void MovingPixelsState::setTransparentColor(bool opaque, const app::Color& color
void MovingPixelsState::dropPixels()
{
LOG("MovingPixels: drop pixels\n");
TRACE("MOVPIXS: dropPixels\n");
// Just change to default state (StandbyState generally). We'll
// receive an onLeaveState() event after this call.

View File

@ -369,7 +369,7 @@ std::string FileSelector::show(
if (!start_folder)
start_folder = fs->getFileItemFromPath(start_folder_path);
LOG("start_folder_path = %s (%p)\n", start_folder_path.c_str(), start_folder);
TRACE("FILESEL: Start folder '%s' (%p)\n", start_folder_path.c_str(), start_folder);
setMinSize(gfx::Size(ui::display_w()*9/10, ui::display_h()*9/10));
remapWindow();

View File

@ -383,7 +383,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source)
if (tool) {
Key* key = this->tool(tool);
if (key && tool_key) {
LOG(" - Shortcut for tool `%s': <%s>\n", tool_id, tool_key);
LOG(VERBOSE) << "KEYS: Shortcut for tool " << tool_id << ": " << tool_key << "\n";
Accelerator accel(tool_key);
if (!removed)
@ -411,7 +411,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source)
if (tool) {
Key* key = this->quicktool(tool);
if (key && tool_key) {
LOG(" - Shortcut for quicktool `%s': <%s>\n", tool_id, tool_key);
LOG(VERBOSE) << "KEYS: Shortcut for quicktool " << tool_id << ": " << tool_key << "\n";
Accelerator accel(tool_key);
if (!removed)
@ -439,7 +439,7 @@ void KeyboardShortcuts::importFile(TiXmlElement* rootElement, KeySource source)
if (action != KeyAction::None) {
Key* key = this->action(action);
if (key && tool_key) {
LOG(" - Shortcut for action '%s': <%s>\n", tool_action, tool_key);
LOG(VERBOSE) << "KEYS: Shortcut for action " << tool_action << ": " << tool_key << "\n";
Accelerator accel(tool_key);
if (!removed)

View File

@ -180,8 +180,6 @@ void ResourcesListBox::onTick()
if (!m_resourcesLoader->next(resource)) {
if (m_resourcesLoader->isDone()) {
stop();
LOG("Done\n");
}
return;
}

View File

@ -14,7 +14,8 @@
#include "base/log.h"
#include "base/string.h"
#include <stdlib.h>
#include <cstdlib>
#include <iostream>
#include "SimpleIni.h"
namespace cfg {
@ -67,8 +68,9 @@ public:
base::FileHandle file(base::open_file(m_filename, "rb"));
if (file) {
SI_Error err = m_ini.LoadFile(file.get());
if (err != SI_OK)
LOG("Error '%d' loading configuration from '%s'.", err, m_filename.c_str());
if (err != SI_OK) {
LOG(ERROR) << "CFG: Error " << err << " loading configuration from " << m_filename << "\n";
}
}
}
@ -76,8 +78,9 @@ public:
base::FileHandle file(base::open_file(m_filename, "wb"));
if (file) {
SI_Error err = m_ini.SaveFile(file.get());
if (err != SI_OK)
LOG("Error '%d' saving configuration into '%s'.", err, m_filename.c_str());
if (err != SI_OK) {
LOG(ERROR) << "CFG: Error " << err << " saving configuration into " << m_filename << "\n";
}
}
}

View File

@ -73,7 +73,7 @@ Palette* load_gpl_file(const char *filename)
base::trim_string(comment, comment);
if (!comment.empty()) {
LOG("%s comment: %s\n", filename, comment.c_str());
LOG(VERBOSE) << "PAL: " << filename << " comment: " << comment << "\n";
pal->setComment(comment);
}

View File

@ -32,7 +32,7 @@ public:
bool createGLContext() override {
m_display = getD3DEGLDisplay((HDC)GetDC((HWND)m_nativeDisplay));
if (m_display == EGL_NO_DISPLAY) {
LOG("Cannot create EGL display");
LOG("OS: Cannot create EGL display");
return false;
}

View File

@ -31,6 +31,8 @@
#endif
#include <iostream>
namespace she {
class SkiaWindow::Impl : public OSXWindowImpl {
@ -197,7 +199,7 @@ private:
m_glInterfaces.reset(GrGLCreateNativeInterface());
if (!m_glInterfaces || !m_glInterfaces->validate()) {
LOG("Cannot create GL interfaces\n");
LOG(ERROR) << "OS: Cannot create GL interfaces\n";
detachGL();
return false;
}
@ -210,10 +212,10 @@ private:
initWithCGLContextObj:static_cast<GLContextCGL*>(m_glCtx.get())->cglContext()];
[m_nsGL setView:m_window.contentView];
LOG("Using CGL backend\n");
LOG("OS: Using CGL backend\n");
}
catch (const std::exception& ex) {
LOG("Cannot create GL context: %s\n", ex.what());
LOG(ERROR) << "OS: Cannot create GL context: " << ex.what() << "\n";
detachGL();
return false;
}

View File

@ -33,6 +33,7 @@
#endif
#include <iostream>
namespace she {
@ -214,10 +215,10 @@ bool SkiaWindow::attachANGLE()
GrContext::Create(kOpenGL_GrBackend,
(GrBackendContext)m_glInterfaces.get()));
LOG("Using EGL backend\n");
LOG("OS: Using EGL backend\n");
}
catch (const std::exception& ex) {
LOG("Error initializing EGL backend: %s\n", ex.what());
LOG(ERROR) << "OS: Error initializing EGL backend: " << ex.what() << "\n";
detachGL();
}
}
@ -250,10 +251,10 @@ bool SkiaWindow::attachGL()
GrContext::Create(kOpenGL_GrBackend,
(GrBackendContext)m_glInterfaces.get()));
LOG("Using WGL backend\n");
LOG("OS: Using WGL backend\n");
}
catch (const std::exception& ex) {
LOG("Error initializing WGL backend: %s\n", ex.what());
LOG(ERROR) << "OS: Error initializing WGL backend: " << ex.what() << "\n";
detachGL();
}
}

View File

@ -16,6 +16,8 @@
#include "base/path.h"
#include "base/string.h"
#include <iostream>
typedef UINT (API* WTInfoW_Func)(UINT, UINT, LPVOID);
typedef HCTX (API* WTOpenW_Func)(HWND, LPLOGCONTEXTW, BOOL);
typedef BOOL (API* WTClose_Func)(HCTX);
@ -57,11 +59,10 @@ HCTX PenAPI::open(HWND hwnd)
ASSERT(logctx.lcOptions & CXO_SYSTEM);
if (infoRes != sizeof(LOGCONTEXTW)) {
LOG("Not supported WTInfo:\n"
" Expected context size: %d\n"
" Actual context size: %d (options %d)\n",
sizeof(LOGCONTEXTW),
infoRes, logctx.lcOptions);
LOG(ERROR)
<< "PEN: Not supported WTInfo:\n"
<< " Expected context size: " << sizeof(LOGCONTEXTW) << "\n"
<< " Actual context size: " << infoRes << " (options " << logctx.lcOptions << ")\n";
return nullptr;
}
@ -75,11 +76,11 @@ HCTX PenAPI::open(HWND hwnd)
HCTX ctx = WTOpen(hwnd, &logctx, TRUE);
if (!ctx) {
LOG("Error attaching pen to display\n");
LOG("PEN: Error attaching pen to display\n");
return nullptr;
}
LOG("Pen attached to display\n");
LOG("PEN: Pen attached to display\n");
return ctx;
}
@ -87,7 +88,7 @@ void PenAPI::close(HCTX ctx)
{
if (ctx) {
ASSERT(m_wintabLib);
LOG("Pen detached from window\n");
LOG("PEN: Pen detached from window\n");
WTClose(ctx);
}
}
@ -103,7 +104,7 @@ bool PenAPI::loadWintab()
m_wintabLib = base::load_dll("wintab32.dll");
if (!m_wintabLib) {
LOG("wintab32.dll is not present\n");
LOG(ERROR) << "PEN: wintab32.dll is not present\n";
return false;
}
@ -112,11 +113,11 @@ bool PenAPI::loadWintab()
WTClose = base::get_dll_proc<WTClose_Func>(m_wintabLib, "WTClose");
WTPacket = base::get_dll_proc<WTPacket_Func>(m_wintabLib, "WTPacket");
if (!WTInfo || !WTOpen || !WTClose || !WTPacket) {
LOG("wintab32.dll does not contain all required functions\n");
LOG(ERROR) << "PEN: wintab32.dll does not contain all required functions\n";
return false;
}
LOG("Pen initialized\n");
LOG("PEN: Pen initialized\n");
return true;
}

View File

@ -40,22 +40,22 @@ public:
base::join_path(base::get_file_path(base::get_app_path()),
STEAM_API_DLL_FILENAME));
if (!m_steamLib) {
LOG("Steam library not found...\n");
LOG("STEAM: Steam library not found...\n");
return;
}
auto SteamAPI_Init = base::get_dll_proc<SteamAPI_Init_Func>(m_steamLib, "SteamAPI_Init");
if (!SteamAPI_Init) {
LOG("SteamAPI_Init not found...\n");
LOG("STEAM: SteamAPI_Init not found...\n");
return;
}
if (!SteamAPI_Init()) {
LOG("Steam is not initialized...\n");
LOG("STEAM: Steam is not initialized...\n");
return;
}
LOG("Steam initialized...\n");
LOG("STEAM: Steam initialized...\n");
m_initialized = true;
}
@ -65,7 +65,7 @@ public:
auto SteamAPI_Shutdown = base::get_dll_proc<SteamAPI_Shutdown_Func>(m_steamLib, "SteamAPI_Shutdown");
if (SteamAPI_Shutdown) {
LOG("Steam shutdown...\n");
LOG("STEAM: Steam shutdown...\n");
SteamAPI_Shutdown();
}