LCOV - code coverage report
Current view: top level - connectivity/source/inc/java/sql - ConnectionLog.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 14 57.1 %
Date: 2015-06-13 12:38:46 Functions: 12 24 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTIONLOG_HXX
      21             : #define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTIONLOG_HXX
      22             : 
      23             : #include <com/sun/star/logging/LogLevel.hpp>
      24             : 
      25             : #include <rtl/ustring.hxx>
      26             : 
      27             : // Strange enough, GCC requires the following forward declarations of the various
      28             : // convertLogArgToString flavors to be *before* the inclusion of comphelper/logging.hxx
      29             : 
      30             : namespace com { namespace sun { namespace star { namespace util
      31             : {
      32             :     struct Date;
      33             :     struct Time;
      34             :     struct DateTime;
      35             : } } } }
      36             : 
      37             : 
      38             : namespace comphelper { namespace log { namespace convert
      39             : {
      40             : 
      41             : 
      42             :     // helpers for logging more data types than are defined in comphelper/logging.hxx
      43             :     OUString convertLogArgToString( const ::com::sun::star::util::Date& _rDate );
      44             :     OUString convertLogArgToString( const ::com::sun::star::util::Time& _rTime );
      45             :     OUString convertLogArgToString( const ::com::sun::star::util::DateTime& _rDateTime );
      46             : 
      47             : 
      48             : } } }
      49             : 
      50             : 
      51             : #include <comphelper/logging.hxx>
      52             : 
      53             : namespace connectivity
      54             : {
      55             :     namespace LogLevel = ::com::sun::star::logging::LogLevel;
      56             : }
      57             : 
      58             : 
      59             : namespace connectivity { namespace java { namespace sql {
      60             : 
      61             :     typedef ::comphelper::ResourceBasedEventLogger  ConnectionLog_Base;
      62       14042 :     class ConnectionLog : public ConnectionLog_Base
      63             :     {
      64             :     public:
      65             :         enum ObjectType
      66             :         {
      67             :             CONNECTION = 0,
      68             :             STATEMENT,
      69             :             RESULTSET,
      70             : 
      71             :             ObjectTypeCount = RESULTSET + 1
      72             :         };
      73             : 
      74             :     private:
      75             :         const   sal_Int32   m_nObjectID;
      76             : 
      77             :     public:
      78             :         /// will construct an instance of ObjectType CONNECTION
      79             :         ConnectionLog( const ::comphelper::ResourceBasedEventLogger& _rDriverLog );
      80             :         /// will create an instance with the same object ID / ObjectType as a given source instance
      81             :         ConnectionLog( const ConnectionLog& _rSourceLog );
      82             :         /// will create an instance of arbitrary ObjectType
      83             :         ConnectionLog( const ConnectionLog& _rSourceLog, ObjectType _eType );
      84             : 
      85         267 :         sal_Int32   getObjectID() const { return m_nObjectID; }
      86             : 
      87             :         /// logs a given message, without any arguments, or source class/method names
      88       28085 :         bool        log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID )
      89             :         {
      90       28085 :             return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID );
      91             :         }
      92             : 
      93             :         template< typename ARGTYPE1 >
      94        1059 :         bool        log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const
      95             :         {
      96        1059 :             return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1 );
      97             :         }
      98             : 
      99             :         template< typename ARGTYPE1, typename ARGTYPE2 >
     100       14773 :         bool        log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
     101             :         {
     102       14773 :             return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2 );
     103             :         }
     104             : 
     105             :         template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
     106           0 :         bool        log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
     107             :         {
     108           0 :             return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2, _argument3 );
     109             :         }
     110             : 
     111             :         template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
     112           0 :         bool        log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
     113             :         {
     114           0 :             return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2, _argument3, _argument4 );
     115             :         }
     116             : 
     117             :         template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
     118           0 :         bool        log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
     119             :         {
     120           0 :             return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2, _argument3, _argument4, _argument5 );
     121             :         }
     122             :     };
     123             : 
     124             : 
     125             : } } } // namespace connectivity::java::sql
     126             : 
     127             : 
     128             : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTIONLOG_HXX
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11