diff options
author | Tor Lillqvist <tml@collabora.com> | 2013-09-08 23:32:57 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2013-09-08 23:51:41 +0300 |
commit | 04c3f9d18501562cb0536dee0fe89334ed7736d1 (patch) | |
tree | eb029af63434dcfe291e133f7f729e68258eb32f | |
parent | 9a8e2d09bc2111371f149498481dd422b86f9b68 (diff) |
Use SAL_INFO instead of framework's own WRITE_LOGFILE
Change-Id: Ieb1a45ca75c7a475d02535cd176396a0aeb68510
-rw-r--r-- | framework/inc/macros/debug.hxx | 19 | ||||
-rw-r--r-- | framework/inc/macros/debug/logmechanism.hxx | 85 | ||||
-rw-r--r-- | framework/source/jobs/joburl.cxx | 12 | ||||
-rw-r--r-- | framework/source/services/autorecovery.cxx | 49 | ||||
-rw-r--r-- | include/sal/log-areas.dox | 2 |
5 files changed, 23 insertions, 144 deletions
diff --git a/framework/inc/macros/debug.hxx b/framework/inc/macros/debug.hxx index e598b51b4245..ca47bb62229b 100644 --- a/framework/inc/macros/debug.hxx +++ b/framework/inc/macros/debug.hxx @@ -30,28 +30,15 @@ // => "personal debug code" #if OSL_DEBUG_LEVEL > 1 - // Enable log mechanism for normal assertion and error handling. - // Look for user decisions before! - #ifndef ENABLE_LOGMECHANISM - #define ENABLE_LOGMECHANISM - #endif - //----------------------------------------------------------------------------------------------------------------- // => "non product" // NOTE #elif OSL_DEBUG_LEVEL > 0 - // Enable log mechanism for normal assertion and error handling. - // Look for user decisions before! - #ifndef ENABLE_LOGMECHANISM - #define ENABLE_LOGMECHANISM - #endif - //----------------------------------------------------------------------------------------------------------------- // => "product" (OSL_DEBUG_LEVEL == 0) #else - #undef ENABLE_LOGMECHANISM #undef ENABLE_EVENTDEBUG #undef ENABLE_REGISTRATIONDEBUG #undef ENABLE_FILTERDBG @@ -59,12 +46,6 @@ #endif //***************************************************************************************************************** -// generic macros for logging -//***************************************************************************************************************** - -#include <macros/debug/logmechanism.hxx> - -//***************************************************************************************************************** // special macros for event handling //***************************************************************************************************************** #include <macros/debug/event.hxx> diff --git a/framework/inc/macros/debug/logmechanism.hxx b/framework/inc/macros/debug/logmechanism.hxx deleted file mode 100644 index b6ad279942cc..000000000000 --- a/framework/inc/macros/debug/logmechanism.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- 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 __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ -#define __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ - -//***************************************************************************************************************** -// generic macros for logging -//***************************************************************************************************************** - -#ifdef ENABLE_LOGMECHANISM - - #include <rtl/string.hxx> - #include <stdio.h> - - /*_____________________________________________________________________________________________________________ - WRITE_LOGFILE( SFILENAME, STEXT ) - - Log any information in file. We append any information at file and don't clear it anymore. - ( Use new scope in macro to declare pFile more then on time in same "parentscope"! - Don't control pFile before access! What will you doing if its not valid? Log an error ... - An error and an error is an error ... ) - - Attention: You must use "%s" and STEXT as parameter ... because otherwise encoded strings (they include e.g. %...) - are handled wrong. - _____________________________________________________________________________________________________________*/ - - #define WRITE_LOGFILE( SFILENAME, STEXT ) \ - { \ - OString _swriteLogfileFileName ( SFILENAME ); \ - OString _swriteLogfileText ( STEXT ); \ - FILE* pFile = fopen( _swriteLogfileFileName.getStr(), "a" ); \ - fprintf( pFile, "%s", _swriteLogfileText.getStr() ); \ - fclose ( pFile ); \ - } - - /*_____________________________________________________________________________________________________________ - LOGTYPE - - For other debug macros we need information about the output mode. If user forget to set this information we - do it for him. Valid values are: LOGTYPE_FILECONTINUE - LOGTYPE_FILEEXIT - LOGTYPE_MESSAGEBOX - The normal case is LOGTYPE_MESSAGEBOX to show assertions in normal manner! - _____________________________________________________________________________________________________________*/ - - #define LOGTYPE_MESSAGEBOX 1 - #define LOGTYPE_FILECONTINUE 2 - #define LOGTYPE_FILEEXIT 3 - - #ifndef LOGTYPE - #define LOGTYPE \ - LOGTYPE_MESSAGEBOX - #endif - -#else // #ifdef ENABLE_LOGMECHANISM - - /*_____________________________________________________________________________________________________________ - If right testmode is'nt set - implements these macro empty! - _____________________________________________________________________________________________________________*/ - - #define WRITE_LOGFILE( SFILENAME, STEXT ) - #undef LOGTYPE - -#endif // #ifdef ENABLE_LOGMECHANISM - -#endif // #ifndef __FRAMEWORK_MACROS_DEBUG_LOGMECHANISM_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/jobs/joburl.cxx b/framework/source/jobs/joburl.cxx index 29874615c0ae..8e48e7b24a98 100644 --- a/framework/source/jobs/joburl.cxx +++ b/framework/source/jobs/joburl.cxx @@ -490,8 +490,7 @@ void JobURL::impldbg_checkURL( /*IN*/ const sal_Char* pURL , OUStringBuffer sMsg(256); - sMsg.appendAscii("\"" ); - sMsg.append (sURL ); + sMsg.append(sURL); sMsg.appendAscii("\" "); if (bOK) @@ -500,8 +499,8 @@ void JobURL::impldbg_checkURL( /*IN*/ const sal_Char* pURL , } else { - sMsg.appendAscii("... failed\n"); - sMsg.appendAscii("expected was: "); + sMsg.appendAscii("... failed. "); + sMsg.appendAscii("Expected: "); if (eExpectedPart==E_UNKNOWN) sMsg.appendAscii("E_UNKNOWN"); if ((eExpectedPart & E_EVENT) == E_EVENT) @@ -522,12 +521,11 @@ void JobURL::impldbg_checkURL( /*IN*/ const sal_Char* pURL , sMsg.appendAscii(pExpectedService ); sMsg.appendAscii("\"" ); } - sMsg.appendAscii("\tbut it was : " ); + sMsg.appendAscii(", Actual: " ); sMsg.append (aURL.impldbg_toString()); - sMsg.appendAscii("\n" ); } - WRITE_LOGFILE(LOGFILE_JOBURL, U2B(sMsg.makeStringAndClear())) + SAL_INFO("fwk.joburl", OUString(sMsg)); } //________________________________ diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 3d3c2dcaa2fa..237c0db7f61e 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -218,22 +218,6 @@ static const sal_Int32 GIVE_UP_RETRY = 1; // in // #define SIMULATE_FULL_DISC //----------------------------------------------- -// #define ENABLE_RECOVERY_LOGGING -#undef ENABLE_RECOVERY_LOGGING -#ifdef ENABLE_RECOVERY_LOGGING - #define LOGFILE_RECOVERY "recovery.log" - - #define LOG_RECOVERY(MSG) \ - { \ - WRITE_LOGFILE(LOGFILE_RECOVERY, MSG) \ - WRITE_LOGFILE(LOGFILE_RECOVERY, "\n") \ - } -#else - #undef LOGFILE_RECOVERY - #define LOG_RECOVERY(MSG) -#endif - -//----------------------------------------------- class CacheLockGuard { private: @@ -470,8 +454,7 @@ void SAL_CALL AutoRecovery::dispatch(const css::util::URL& const css::uno::Sequence< css::beans::PropertyValue >& lArguments) throw(css::uno::RuntimeException) { - LOG_RECOVERY("AutoRecovery::dispatch() starts ...") - LOG_RECOVERY(U2B(aURL.Complete).getStr()) + SAL_INFO("fwk.autorecovery", "AutoRecovery::dispatch() starts ..." << OUString(aURL.Complete)); // valid request ? sal_Int32 eNewJob = AutoRecovery::implst_classifyJob(aURL); @@ -488,7 +471,7 @@ void SAL_CALL AutoRecovery::dispatch(const css::util::URL& ((m_eJob & AutoRecovery::E_AUTO_SAVE ) != AutoRecovery::E_AUTO_SAVE) ) { - SAL_INFO("fwk", "AutoRecovery::dispatch(): There is already an asynchronous dispatch() running. New request will be ignored!"); + SAL_INFO("fwk.autorecovery", "AutoRecovery::dispatch(): There is already an asynchronous dispatch() running. New request will be ignored!"); return; } @@ -599,7 +582,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY ) != AutoRecovery::E_DISABLE_AUTORECOVERY ) ) { - LOG_RECOVERY("... prepare emergency save ...") + SAL_INFO("fwk.autorecovery", "... prepare emergency save ..."); bAllowAutoSaveReactivation = sal_False; implts_prepareEmergencySave(); } @@ -609,7 +592,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY) ) { - LOG_RECOVERY("... do emergency save ...") + SAL_INFO("fwk.autorecovery", "... do emergency save ..."); bAllowAutoSaveReactivation = sal_False; implts_doEmergencySave(aParams); } @@ -619,7 +602,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY) ) { - LOG_RECOVERY("... do recovery ...") + SAL_INFO("fwk.autorecovery", "... do recovery ..."); implts_doRecovery(aParams); } else @@ -628,7 +611,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY) ) { - LOG_RECOVERY("... do session save ...") + SAL_INFO("fwk.autorecovery", "... do session save ..."); bAllowAutoSaveReactivation = sal_False; implts_doSessionSave(aParams); } @@ -638,7 +621,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY) ) { - LOG_RECOVERY("... do session quiet quit ...") + SAL_INFO("fwk.autorecovery", "... do session quiet quit ..."); bAllowAutoSaveReactivation = sal_False; implts_doSessionQuietQuit(aParams); } @@ -648,7 +631,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY) ) { - LOG_RECOVERY("... do session restore ...") + SAL_INFO("fwk.autorecovery", "... do session restore ..."); implts_doSessionRestore(aParams); } else @@ -2037,7 +2020,7 @@ void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo) //----------------------------------------------- void AutoRecovery::implts_prepareSessionShutdown() { - LOG_RECOVERY("AutoRecovery::implts_prepareSessionShutdown() starts ...") + SAL_INFO("fwk.autorecovery", "AutoRecovery::implts_prepareSessionShutdown() starts ..."); // a) reset modified documents (of course the must be saved before this method is called!) // b) close it without showing any UI! @@ -3040,7 +3023,7 @@ void AutoRecovery::implts_doRecovery(const DispatchParams& aParams) //----------------------------------------------- void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) { - LOG_RECOVERY("AutoRecovery::implts_doSessionSave()") + SAL_INFO("fwk.autorecovery", "AutoRecovery::implts_doSessionSave()"); // Be sure to know all open documents realy .-) implts_verifyCacheAgainstDesktopDocumentList(); @@ -3079,7 +3062,7 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) //----------------------------------------------- void AutoRecovery::implts_doSessionQuietQuit(const DispatchParams& /*aParams*/) { - LOG_RECOVERY("AutoRecovery::implts_doSessionQuietQuit()") + SAL_INFO("fwk.autorecovery", "AutoRecovery::implts_doSessionQuietQuit()"); // try to make sure next time office will be started user wont be // notified about any other might be running office instance @@ -3111,7 +3094,7 @@ void AutoRecovery::implts_doSessionQuietQuit(const DispatchParams& /*aParams*/) //----------------------------------------------- void AutoRecovery::implts_doSessionRestore(const DispatchParams& aParams) { - LOG_RECOVERY("AutoRecovery::implts_doSessionRestore() ...") + SAL_INFO("fwk.autorecovery", "AutoRecovery::implts_doSessionRestore() ..."); AutoRecovery::ETimerType eSuggestedTimer = AutoRecovery::E_DONT_START_TIMER; do @@ -3131,7 +3114,7 @@ void AutoRecovery::implts_doSessionRestore(const DispatchParams& aParams) implts_changeAllDocVisibility(sal_True); // Reset the configuration hint for "session save"! - LOG_RECOVERY("... reset config key 'SessionData'") + SAL_INFO("fwk.autorecovery", "... reset config key 'SessionData'"); ::comphelper::ConfigurationHelper::writeDirectKey( m_xContext, OUString(CFG_PACKAGE_RECOVERY), @@ -3140,7 +3123,7 @@ void AutoRecovery::implts_doSessionRestore(const DispatchParams& aParams) css::uno::makeAny(sal_False), ::comphelper::ConfigurationHelper::E_STANDARD); - LOG_RECOVERY("... AutoRecovery::implts_doSessionRestore()") + SAL_INFO("fwk.autorecovery", "... AutoRecovery::implts_doSessionRestore()"); } //----------------------------------------------- @@ -3358,7 +3341,7 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL AutoRecovery::getPr //----------------------------------------------- void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() { - LOG_RECOVERY("AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() ...") + SAL_INFO("fwk.autorecovery", "AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() ..."); // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); @@ -3432,7 +3415,7 @@ void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() { } - LOG_RECOVERY("... AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList()") + SAL_INFO("fwk.autorecovery", "... AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList()"); } //----------------------------------------------- diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index 3d08cf129a4c..36c1fbf7597d 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -155,8 +155,10 @@ certain functionality. @li @c fwk - framework (abbreviation) @li @c fwk.accelerators +@li @c fwk.autorecovery @li @c fwk.desktop @li @c fwk.dispatch +@li @c fwk.joburl @li @c fwk.loadenv @li @c fwk.session @li @c fwk.uielement |