Kaydet (Commit) 51d1545e authored tarafından Jan Holesovsky's avatar Jan Holesovsky

writerfilter: Kill debug_logger.

Does not really log interesting stuff; if anybody wants some kind of logging
like this, better to use SAL_INFO(), and add it only for really interesting
stuff.

Change-Id: I11b4caa9660aaf1e70819322b7fc207a544ea3bb
üst 58d6e4fd
......@@ -81,11 +81,6 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
OUString sURL = aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_URL(), OUString() );
::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr();
writerfilter::TagLogger::Pointer_t debugLogger
(writerfilter::TagLogger::getInstance("DEBUG"));
debugLogger->setFileName(sURLc);
debugLogger->startDocument();
writerfilter::TagLogger::Pointer_t dmapperLogger
(writerfilter::TagLogger::getInstance("DOMAINMAPPER"));
dmapperLogger->setFileName(sURLc);
......@@ -184,10 +179,9 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes
}
pStream.reset();
#ifdef DEBUG_IMPORT
#ifdef DEBUG_IMPORT
dmapperLogger->endDocument();
debugLogger->endDocument();
#endif
return sal_True;
......
......@@ -31,7 +31,6 @@
#include "OOXMLBinaryObjectReference.hxx"
#include "OOXMLFastDocumentHandler.hxx"
#include "OOXMLPropertySetImpl.hxx"
#include "ooxmlLoggers.hxx"
#include <tools/resmgr.hxx>
#include <vcl/svapp.hxx>
......@@ -48,10 +47,6 @@ namespace writerfilter {
namespace ooxml
{
#if OSL_DEBUG_LEVEL > 1
TagLogger::Pointer_t debug_logger(TagLogger::getInstance("DEBUG"));
#endif
OOXMLDocumentImpl::OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream, const uno::Reference<task::XStatusIndicator>& xStatusIndicator)
: mpStream(pStream)
, mxStatusIndicator(xStatusIndicator)
......@@ -284,12 +279,6 @@ writerfilter::Reference<Stream>::Pointer_t
OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, const Id & rType,
const sal_Int32 nId)
{
#ifdef DEBUG_ELEMENT
debug_logger->startElement("getXNoteStream");
debug_logger->attribute("id", nId);
debug_logger->endElement();
#endif
OOXMLStream::Pointer_t pStream =
(OOXMLDocumentFactory::createStream(mpStream, nType));
// See above, no status indicator for the note stream, either.
......@@ -445,10 +434,6 @@ void OOXMLDocumentImpl::resolveFooter(Stream & rStream,
void OOXMLDocumentImpl::resolve(Stream & rStream)
{
#ifdef DEBUG_RESOLVE
debug_logger->startElement("OOXMLDocumentImpl.resolve");
#endif
uno::Reference< xml::sax::XFastParser > xParser
(mpStream->getFastParser());
......@@ -517,18 +502,11 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
xParser->parseStream(aParserInput);
}
catch (...) {
#ifdef DEBUG_ELEMENT
debug_logger->element("exception");
#endif
}
}
if (mxStatusIndicator.is())
mxStatusIndicator->end();
#ifdef DEBUG_RESOLVE
debug_logger->endElement();
#endif
}
void OOXMLDocumentImpl::incrementProgress()
......
......@@ -125,14 +125,6 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
if (pFactory.get() != NULL)
{
#ifdef DEBUG_FACTORY
debug_logger->startElement("factory.attributes");
debug_logger->attribute("define", pFactory->getDefineName(nDefine));
char sBuffer[256];
snprintf(sBuffer, sizeof(sBuffer), "%08" SAL_PRIxUINT32, nDefine);
debug_logger->attribute("define-num", sBuffer);
#endif
TokenToIdMapPointer pTokenToIdMap = pFactory->getTokenToIdMap(nDefine);
AttributeToResourceMapPointer pMap = pFactory->getAttributeToResourceMap(nDefine);
......@@ -142,22 +134,12 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
for (aIt = pMap->begin(); aIt != aEndIt; ++aIt)
{
Id nId = (*pTokenToIdMap)[aIt->first];
#ifdef DEBUG_FACTORY
debug_logger->startElement("factory.attribute");
debug_logger->attribute("name", fastTokenToId(aIt->first));
debug_logger->attribute("tokenid", (*QNameToString::Instance())(nId));
snprintf(sBuffer, sizeof(sBuffer), "%08" SAL_PRIxUINT32, nId);
debug_logger->attribute("tokenid-num", sBuffer);
#endif
if (Attribs->hasAttribute(aIt->first))
{
switch (aIt->second.m_nResource)
{
case RT_Boolean:
{
#ifdef DEBUG_FACTORY
debug_logger->element("boolean");
#endif
OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLBooleanValue>::newProperty(pHandler, nId, aValue);
......@@ -167,9 +149,6 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case RT_String:
{
#ifdef DEBUG_FACTORY
debug_logger->element("string");
#endif
OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLStringValue>::newProperty
(pHandler, nId, aValue);
......@@ -180,9 +159,6 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case RT_Integer:
{
#ifdef DEBUG_FACTORY
debug_logger->element("integer");
#endif
OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLIntegerValue>::newProperty
(pHandler, nId, aValue);
......@@ -193,9 +169,6 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case RT_Hex:
{
#ifdef DEBUG_FACTORY
debug_logger->element("hex");
#endif
OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLHexValue>::newProperty
(pHandler, nId, aValue);
......@@ -206,9 +179,6 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case RT_UniversalMeasure:
{
#ifdef DEBUG_FACTORY
debug_logger->element("universalMeasure");
#endif
OUString aValue(Attribs->getValue(aIt->first));
OOXMLFastHelper<OOXMLUniversalMeasureValue>::newProperty(pHandler, nId, aValue);
......@@ -218,9 +188,6 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
break;
case RT_List:
{
#ifdef DEBUG_FACTORY
debug_logger->startElement("list");
#endif
ListValueMapPointer pListValueMap =
pFactory->getListValueMap(aIt->second.m_nRef);
......@@ -229,37 +196,19 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
OUString aValue(Attribs->getValue(aIt->first));
sal_uInt32 nValue = (*pListValueMap)[aValue];
#ifdef DEBUG_FACTORY
debug_logger->attribute("value", aValue);
debug_logger->attribute("value-num", nValue);
#endif
OOXMLFastHelper<OOXMLIntegerValue>::newProperty
(pHandler, nId, nValue);
OOXMLValue::Pointer_t pValue(new OOXMLIntegerValue(nValue));
pFactory->attributeAction(pHandler, aIt->first, pValue);
}
#ifdef DEBUG_FACTORY
debug_logger->endElement();
#endif
}
break;
default:
#ifdef DEBUG_FACTORY
debug_logger->element("unknown-attribute-type");
#endif
break;
}
}
#ifdef DEBUG_FACTORY
debug_logger->endElement();
#endif
}
#ifdef DEBUG_FACTORY
debug_logger->endElement();
#endif
}
}
......@@ -267,11 +216,6 @@ uno::Reference< xml::sax::XFastContextHandler>
OOXMLFactory::createFastChildContext(OOXMLFastContextHandler * pHandler,
Token_t Element)
{
#ifdef DEBUG_FACTORY
debug_logger->startElement("factory.createFastChildContext");
debug_logger->attribute("token", fastTokenToId(Element));
#endif
Id nDefine = pHandler->getDefine();
OOXMLFactory_ns::Pointer_t pFactory = getFactoryForNamespace(nDefine);
......@@ -282,21 +226,12 @@ OOXMLFactory::createFastChildContext(OOXMLFastContextHandler * pHandler,
if ((Element & 0xffff) < OOXML_FAST_TOKENS_END)
ret = createFastChildContextFromFactory(pHandler, pFactory, Element);
#ifdef DEBUG_FACTORY
debug_logger->endElement();
#endif
return ret;
}
void OOXMLFactory::characters(OOXMLFastContextHandler * pHandler,
const OUString & rString)
{
#ifdef DEBUG_FACTORY
debug_logger->startElement("factory.characters");
debug_logger->chars(rString);
#endif
Id nDefine = pHandler->getDefine();
OOXMLFactory_ns::Pointer_t pFactory = getFactoryForNamespace(nDefine);
......@@ -304,10 +239,6 @@ void OOXMLFactory::characters(OOXMLFastContextHandler * pHandler,
{
pFactory->charactersAction(pHandler, rString);
}
#ifdef DEBUG_FACTORY
debug_logger->endElement();
#endif
}
void OOXMLFactory::startAction(OOXMLFastContextHandler * pHandler, Token_t /*nToken*/)
......@@ -317,13 +248,7 @@ void OOXMLFactory::startAction(OOXMLFastContextHandler * pHandler, Token_t /*nTo
if (pFactory.get() != NULL)
{
#ifdef DEBUG_ELEMENT
debug_logger->startElement("factory.startAction");
#endif
pFactory->startAction(pHandler);
#ifdef DEBUG_ELEMENT
debug_logger->endElement();
#endif
}
}
......@@ -334,13 +259,7 @@ void OOXMLFactory::endAction(OOXMLFastContextHandler * pHandler, Token_t /*nToke
if (pFactory.get() != NULL)
{
#ifdef DEBUG_ELEMENT
debug_logger->startElement("factory.endAction");
#endif
pFactory->endAction(pHandler);
#ifdef DEBUG_ELEMENT
debug_logger->endElement();
#endif
}
}
......
......@@ -243,10 +243,6 @@ protected:
Id mnDefine;
Token_t mnToken;
#ifdef DEBUG_CONTEXT_HANDLER
string msTokenString;
#endif
// the stream to send the stream events to.
Stream * mpStream;
......@@ -274,10 +270,7 @@ protected:
throw (uno::RuntimeException, xml::sax::SAXException);
void startAction(Token_t Element);
virtual void lcl_startAction(Token_t Element);
void endAction(Token_t Element);
virtual void lcl_endAction(Token_t Element);
virtual OOXMLPropertySet * getPicturePropSet
(const OUString & rId);
......
......@@ -22,7 +22,7 @@
#include <iostream>
#include <resourcemodel/QNameToString.hxx>
#include "OOXMLFastContextHandler.hxx"
#include "ooxmlLoggers.hxx"
namespace writerfilter {
namespace ooxml
......@@ -52,31 +52,12 @@ uno::Reference<css::xml::sax::XFastContextHandler>
OOXMLFastHelper<T>::createAndSetParentAndDefine
(OOXMLFastContextHandler * pHandler, sal_uInt32 nToken, Id nId, Id nDefine)
{
#ifdef DEBUG_HELPER
debug_logger->startElement("helper.createAndSetParentAndDefine");
debug_logger->attribute("context", pHandler->getType());
debug_logger->attribute("id", (*QNameToString::Instance())(nId));
static char buffer[16];
snprintf(buffer, sizeof(buffer), "0x%08" SAL_PRIxUINT32, nId);
debug_logger->attribute("idnum", buffer);
#endif
OOXMLFastContextHandler * pTmp = new T(pHandler);
pTmp->setToken(nToken);
pTmp->setId(nId);
pTmp->setDefine(nDefine);
#ifdef DEBUG_HELPER
debug_logger->startElement("created");
debug_logger->addTag(pTmp->toTag());
debug_logger->endElement("created");
debug_logger->endElement("helper.createAndSetParentAndDefine");
#endif
css::uno::Reference<css::xml::sax::XFastContextHandler> aResult(pTmp);
return aResult;
......@@ -89,26 +70,7 @@ void OOXMLFastHelper<T>::newProperty(OOXMLFastContextHandler * pHandler,
{
OOXMLValue::Pointer_t pVal(new T(rValue));
#ifdef DEBUG_HELPER
string aStr = (*QNameToString::Instance())(nId);
debug_logger->startElement("newProperty-from-string");
debug_logger->attribute("name", aStr);
debug_logger->attribute
("value",
OUStringToOString
(rValue, RTL_TEXTENCODING_ASCII_US).getStr());
if (aStr.empty())
debug_logger->element( "unknown-qname" );
#endif
pHandler->newProperty(nId, pVal);
#ifdef DEBUG_HELPER
debug_logger->endElement();
#endif
}
template <class T>
......@@ -118,19 +80,6 @@ void OOXMLFastHelper<T>::newProperty(OOXMLFastContextHandler * pHandler,
{
OOXMLValue::Pointer_t pVal(new T(nVal));
#ifdef DEBUG_HELPER
string aStr = (*QNameToString::Instance())(nId);
debug_logger->startElement("helper.newProperty-from-int");
debug_logger->attribute("name", aStr);
debug_logger->attribute("value", pVal->toString());
if (aStr.empty())
debug_logger->element("unknown-qname");
debug_logger->endElement();
#endif
pHandler->newProperty(nId, pVal);
}
......
......@@ -20,7 +20,6 @@
#include <stdio.h>
#include <iostream>
#include "OOXMLParserState.hxx"
#include "ooxmlLoggers.hxx"
namespace writerfilter {
namespace ooxml
......@@ -118,16 +117,8 @@ void OOXMLParserState::resolveCharacterProperties(Stream & rStream)
{
if (mpCharacterProps.get() != NULL)
{
#ifdef DEBUG_PROPERTIES
debug_logger->startElement("resolveCharacterProperties");
#endif
rStream.props(mpCharacterProps);
mpCharacterProps.reset(new OOXMLPropertySetImpl());
#ifdef DEBUG_PROPERTIES
debug_logger->endElement();
#endif
}
}
......
......@@ -23,7 +23,6 @@
#include <resourcemodel/QNameToString.hxx>
#include <com/sun/star/drawing/XShape.hpp>
#include <ooxml/OOXMLFastTokens.hxx>
#include "ooxmlLoggers.hxx"
#include <ooxml/resourceids.hxx>
namespace writerfilter {
......@@ -401,28 +400,16 @@ OOXMLPropertySetImpl::~OOXMLPropertySetImpl()
void OOXMLPropertySetImpl::resolve(Properties & rHandler)
{
size_t nIt = 0;
// The pProp->resolve(rHandler) call below can cause elements to
// be appended to mProperties. I don't think it can cause elements
// to be deleted. But let's check with < here just to be safe that
// the indexing below works.
while (nIt < mProperties.size())
for (size_t nIt = 0; nIt < mProperties.size(); ++nIt)
{
OOXMLProperty::Pointer_t pProp = mProperties[nIt];
if (pProp.get() != NULL)
pProp->resolve(rHandler);
#ifdef DEBUG_RESOLVE
else
{
debug_logger->startElement("error");
debug_logger->chars(std::string("zero-property"));
debug_logger->endElement();
}
#endif
++nIt;
}
}
......@@ -455,11 +442,6 @@ string OOXMLPropertySetImpl::getType() const
void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty)
{
#ifdef DEBUG_PROPERTY_SET
debug_logger->startElement("propertyset.add");
debug_logger->chars(pProperty->toString());
#endif
if (pProperty.get() != NULL && pProperty->getId() != 0x0)
{
/*
......@@ -477,14 +459,6 @@ void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty)
else
mProperties.push_back(pProperty);
}
#ifdef DEBUG_PROPERTY_SET
else
{
debug_logger->element("warning.property_not_added");
}
debug_logger->endElement("propertyset.add");
#endif
}
void OOXMLPropertySetImpl::add(OOXMLPropertySet::Pointer_t pPropertySet)
......
......@@ -19,7 +19,6 @@
#include "OOXMLStreamImpl.hxx"
#include "OOXMLFastTokenHandler.hxx"
#include "ooxmlLoggers.hxx"
#include <iostream>
#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
......@@ -77,9 +76,6 @@ OOXMLStreamImpl::OOXMLStreamImpl
OOXMLStreamImpl::~OOXMLStreamImpl()
{
#ifdef DEBUG_STREAM
debug_logger->endElement("stream");
#endif
}
const OUString & OOXMLStreamImpl::getTarget() const
......@@ -364,10 +360,6 @@ void OOXMLStreamImpl::init()
{
bool bFound = lcl_getTarget(mxRelationshipAccess,
mnStreamType, msId, msTarget);
#ifdef DEBUG_STREAM
debug_logger->startElement("stream");
debug_logger->attribute("target", msTarget);
#endif
if (bFound)
{
......
......@@ -62,10 +62,6 @@ uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastCh
uno::Reference &lt; xml::sax::XFastContextHandler &gt; aResult;
Id nDefine = pHandler->getDefine();
#ifdef DEBUG_FACTORY
debug_logger->startElement("factory.createFastChildContextFromFactory");
#endif
if (pFactory.get() != NULL)
{
CreateElementMapPointer pMap = pFactory-&gt;getCreateElementMap(nDefine);
......@@ -74,25 +70,6 @@ uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastCh
if (pMap.get() != NULL)
{
Id nId = (*pTokenMap)[Element];
#ifdef DEBUG_FACTORY
string sFactoryName(pFactory->getName());
string sDefine(pFactory->getDefineName(nDefine));
string sElement(fastTokenToId(Element));
string sQName((*QNameToString::Instance())(nId));
debug_logger->attribute("factory-name", sFactoryName);
debug_logger->attribute("define", sDefine);
debug_logger->attribute("element", sElement);
debug_logger->attribute("qname", sQName);
static char buffer[16];
snprintf(buffer, sizeof(buffer), "0x%08" SAL_PRIuUINT32, nId);
debug_logger->attribute("idnum", buffer);
snprintf(buffer, sizeof(buffer), "0x%08" SAL_PRIuUINT32, nDefine);
debug_logger->attribute("definenum", buffer);
#endif
CreateElement aCreateElement = (*pMap)[Element];
switch (aCreateElement.m_nResource)
......@@ -127,10 +104,6 @@ uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastCh
}
}
#ifdef DEBUG_FACTORY
debug_logger->endElement();
#endif
return aResult;
}
</xsl:text>
......@@ -169,10 +142,6 @@ OOXMLFactory_ns::Pointer_t OOXMLFactory::getFactoryForNamespace(Id nId)
uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastChildContextFromStart
(OOXMLFastContextHandler * pHandler, Token_t Element)
{
#ifdef DEBUG_FACTORY
debug_logger->startElement("factory.createFastChildContextFromStart");
#endif
uno::Reference &lt; xml::sax::XFastContextHandler &gt; aResult;
OOXMLFactory_ns::Pointer_t pFactory;
......@@ -189,9 +158,6 @@ uno::Reference&lt; xml::sax::XFastContextHandler &gt; OOXMLFactory::createFastCh
</xsl:for-each>
<xsl:text>
#ifdef DEBUG_FACTORY
debug_logger->endElement();
#endif
return aResult;
}
</xsl:text>
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLLOGGERS_HXX
#define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLLOGGERS_HXX
#if OSL_DEBUG_LEVEL > 1
#include <resourcemodel/TagLogger.hxx>
namespace writerfilter {
namespace ooxml {
extern TagLogger::Pointer_t debug_logger;
}
}
#endif
#endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLLOGGERS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment