1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <com/sun/star/logging/LogLevel.hpp>
24 #include <rtl/ustring.hxx>
26 // Strange enough, GCC requires the following forward declarations of the various
27 // convertLogArgToString flavors to be *before* the inclusion of comphelper/logging.hxx
29 namespace com::sun::star::util
37 namespace comphelper::log::convert
41 // helpers for logging more data types than are defined in comphelper/logging.hxx
42 OUString
convertLogArgToString( const css::util::Date
& _rDate
);
43 OUString
convertLogArgToString( const css::util::Time
& _rTime
);
44 OUString
convertLogArgToString( const css::util::DateTime
& _rDateTime
);
50 #include <comphelper/logging.hxx>
52 namespace connectivity
54 namespace LogLevel
= css::logging::LogLevel
;
58 namespace connectivity::java::sql
{
60 typedef ::comphelper::EventLogger ConnectionLog_Base
;
61 class ConnectionLog
: public ConnectionLog_Base
70 ObjectTypeCount
= RESULTSET
+ 1
74 const sal_Int32 m_nObjectID
;
77 /// will construct an instance of ObjectType CONNECTION
78 ConnectionLog( const ::comphelper::EventLogger
& _rDriverLog
);
79 /// will create an instance with the same object ID / ObjectType as a given source instance
80 ConnectionLog( const ConnectionLog
& _rSourceLog
);
81 /// will create an instance of arbitrary ObjectType
82 ConnectionLog( const ConnectionLog
& _rSourceLog
, ObjectType _eType
);
84 sal_Int32
getObjectID() const { return m_nObjectID
; }
86 /// logs a given message, without any arguments, or source class/method names
87 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
)
89 ConnectionLog_Base::log( _nLogLevel
, rMessage
, m_nObjectID
);
92 template< typename ARGTYPE1
>
93 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
, ARGTYPE1 _argument1
) const
95 ConnectionLog_Base::log( _nLogLevel
, rMessage
, m_nObjectID
, _argument1
);
98 template< typename ARGTYPE1
, typename ARGTYPE2
>
99 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
101 ConnectionLog_Base::log( _nLogLevel
, rMessage
, m_nObjectID
, _argument1
, _argument2
);
104 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
105 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
107 ConnectionLog_Base::log( _nLogLevel
, rMessage
, m_nObjectID
, _argument1
, _argument2
, _argument3
);
110 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
111 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
113 ConnectionLog_Base::log( _nLogLevel
, rMessage
, m_nObjectID
, _argument1
, _argument2
, _argument3
, _argument4
);
116 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
117 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
119 ConnectionLog_Base::log( _nLogLevel
, rMessage
, m_nObjectID
, _argument1
, _argument2
, _argument3
, _argument4
, _argument5
);
124 } // namespace connectivity::java::sql
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */