INTEGRATION: CWS sdblogging (1.1.2); FILE ADDED

2007/04/18 06:59:56 fs 1.1.2.2: better documentation (coming from interface-discuss)
2007/04/17 14:02:34 fs 1.1.2.1: #i76119# new logging API
This commit is contained in:
Jens-Heiner Rechtien 2007-06-27 13:48:34 +00:00
parent 45ecff7b72
commit 8b27fef704

View file

@ -0,0 +1,156 @@
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XLogger.idl,v $
*
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2007-06-27 14:48:34 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
#ifndef __com_sun_star_logging_XLogger_idl__
#define __com_sun_star_logging_XLogger_idl__
#ifndef __com_sun_star_uno_XInterface_idl__
#include <com/sun/star/uno/XInterface.idl>
#endif
//=============================================================================
module com { module sun { module star { module logging {
interface XLogHandler;
//=============================================================================
/** implemented by a component which is able to log events.
<p>This interface is roughly designed after the
<a href="http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html">Java
Logging API</a>. However, there are some differences, the major ones being:
<ul><li>There's no support (yet) for filtering log events.</li>
<li>There ain't no convenience menthods for logging.</li>
<li>There's no localization support.</li>
<li>Logger instances do not form a hierarchy.</li>
</ul></p>
@since OOo 2.3
*/
interface XLogger
{
/** denotes the name of the logger.
*/
[attribute, readonly] string Name;
/** specifies which log events are logged or ignored.
@see LogLevel
*/
[attribute] long Level;
/** adds the given handler to the list of handlers.
<p>When an event is logged, the logger will create a <type>LogRecord</type>
for this event, and pass this record to all registered handlers. Single handlers
might or might not log those records at their own discretion, and depending on
additional restrictions such as filters specified at handler level.</p>
<p>Note: The log level of the given handler (<member>XLogHandler::Level</member>) will
not be touched. In particular, it will not be set to the logger's log level. It's
the responsibility of the component which knits a logger with one or more
log handlers to ensure that all loggers have appropriate levels set.</p>
@param LogHandler
the handler to add to the list of handlers. The call is ignored if this
parameter is <NULL/>.
*/
void addLogHandler( [in] XLogHandler LogHandler );
/** removes the given handler from the list of handlers.
@param LogHandler
the handler to remove from the list of handlers. The call is ignored if this
parameter is <NULL/>, or if the handler has not previously beed added.
*/
void removeLogHandler( [in] XLogHandler LogHandler );
/** determines whether logger instance would produce any output for the given level.
<p>The method can be used to optimize performance as maybe complex parameter evaluation
in the <code>log</code> calls can be omitted if <code>isLoggable</code> evaluates to false.</p>
@param Level
level to be checked against
@returns
<TRUE/> if there would be some output for this XLogger for the given level, <FALSE/>
otherwise. Note that a return value of <FALSE/> could also indicate that the logger
does not have any log handlers associated with it.
@see addLogHandler
@see removeLogHandler
*/
boolean isLoggable( [in] long Level );
/** logs a given message
@param Level
the log level of this message. If this level is smaller than the logger's <member>Level</member>
attribute, then the call will be ignored.
@param Message
the message to log
*/
void log( [in] long Level, [in] string Message );
/** logs a given message, detailing the source class and method at which the logged
event occured.
@param Level
the log level of this message. If this level is smaller than the logger's <member>Level</member>
attribute, then the call will be ignored.
@param SourceClass
the source class at which the logged event occured.
@param SourceMethod
the source class at which the logged event occured.
@param Message
the message to log
*/
void logp( [in] long Level, [in] string SourceClassName, [in] string SourceMethodName, [in] string Message );
};
//=============================================================================
}; }; }; };
//=============================================================================
#endif