/**************************************************************
*
* 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
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef __com_sun_star_logging_XLogger_idl__
#define __com_sun_star_logging_XLogger_idl__
#ifndef __com_sun_star_uno_XInterface_idl__
#include
#endif
//=============================================================================
module com { module sun { module star { module logging {
published interface XLogHandler;
//=============================================================================
/** implemented by a component which is able to log events.
This interface is roughly designed after the
Java
Logging API. However, there are some differences, the major ones being:
- There's no support (yet) for filtering log events.
- There ain't no convenience menthods for logging.
- There's no localization support.
- Logger instances do not form a hierarchy.
@since OpenOffice 2.3
*/
published 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.
When an event is logged, the logger will create a LogRecord
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.
Note: The log level of the given handler (XLogHandler::Level) 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.
@param LogHandler
the handler to add to the list of handlers. The call is ignored if this
parameter is .
*/
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 , 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.
The method can be used to optimize performance as maybe complex parameter evaluation
in the log
calls can be omitted if isLoggable
evaluates to false.
@param Level
level to be checked against
@returns
if there would be some output for this XLogger for the given level,
otherwise. Note that a return value of 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 Level
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 occurred.
@param Level
the log level of this message. If this level is smaller than the logger's Level
attribute, then the call will be ignored.
@param SourceClass
the source class at which the logged event occurred.
@param SourceMethod
the source class at which the logged event occurred.
@param Message
the message to log
*/
void logp( [in] long Level, [in] string SourceClassName, [in] string SourceMethodName, [in] string Message );
};
//=============================================================================
}; }; }; };
//=============================================================================
#endif