loolwsd: logging and cosmetics

Change-Id: Idb2cdc22555d237a162b58cacbfd1986f8bc7656
Reviewed-on: https://gerrit.libreoffice.org/24383
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-04-25 22:44:58 -04:00 committed by Ashod Nakashian
parent d07a582469
commit 5cfc7b6580
2 changed files with 9 additions and 10 deletions

View file

@ -727,19 +727,19 @@ void MasterProcessSession::dispatchChild()
void MasterProcessSession::forwardToPeer(const char *buffer, int length)
{
const auto message = getAbbreviatedMessage(buffer, length);
Log::trace(getName() + " Forward: " + message);
auto peer = _peer.lock();
if (!peer)
{
throw Poco::ProtocolException(getName() + ": no peer to forward to.");
throw Poco::ProtocolException(getName() + ": no peer to forward to: [" + message + "].");
}
else if (peer->isCloseFrame())
{
Log::trace(getName() + ": peer begin the closing handshake");
Log::trace(getName() + ": peer began the closing handshake. Dropping forward message [" + message + "].");
return;
}
Log::trace(getName() + " -> " + peer->getName() + ": " + message);
peer->sendBinaryFrame(buffer, length);
}

View file

@ -51,7 +51,9 @@ TileCache::TileCache(const std::string& docURL,
_docURL(docURL),
_cacheDir(cacheDir)
{
Log::info("TileCache ctor for uri [" + _docURL + "] modifiedTime=" + std::to_string(modifiedTime.raw()/1000000) + " getLastModified()=" + std::to_string(getLastModified().raw()/1000000));
Log::info() << "TileCache ctor for uri [" << _docURL
<< "] modifiedTime=" << (modifiedTime.raw()/1000000)
<< " getLastModified()=" << (getLastModified().raw()/1000000) << Log::end;
File directory(_cacheDir);
if (directory.exists() &&
(getLastModified() < modifiedTime ||
@ -86,12 +88,9 @@ std::shared_ptr<TileCache::TileBeingRendered> TileCache::findTileBeingRendered(i
{
const std::string cachedName = cacheFileName(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
auto tile = _tilesBeingRendered.find(cachedName);
const auto tile = _tilesBeingRendered.find(cachedName);
if (tile == _tilesBeingRendered.end())
return nullptr;
return tile->second;
return (tile != _tilesBeingRendered.end() ? tile->second : nullptr);
}
void TileCache::forgetTileBeingRendered(int part, int width, int height, int tilePosX, int tilePosY, int tileWidth, int tileHeight)
@ -268,7 +267,7 @@ void TileCache::removeFile(const std::string& fileName)
const std::string fullFileName = _cacheDir + "/" + fileName;
if (std::remove(fullFileName.c_str()) == 0)
Log::info("Removed file: " + _cacheDir + "/" + fileName);
Log::info("Removed file: " + fullFileName);
}
std::string TileCache::cacheFileName(int part, int width, int height, int tilePosX, int tilePosY, int tileWidth, int tileHeight)