1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XLogger.idl,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __com_sun_star_logging_XLogger_idl__
32 #define __com_sun_star_logging_XLogger_idl__
34 #ifndef __com_sun_star_uno_XInterface_idl__
35 #include
<com
/sun
/star
/uno
/XInterface.idl
>
38 //=============================================================================
40 module com
{ module sun
{ module star
{ module logging
{
42 interface XLogHandler
;
44 //=============================================================================
46 /** implemented by a component which is able to log events.
48 <p>This interface is roughly designed after the
49 <a href="http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html">Java
50 Logging API</a>. However, there are some differences, the major ones being:
51 <ul><li>There's no support (yet) for filtering log events.</li>
52 <li>There ain't no convenience menthods for logging.</li>
53 <li>There's no localization support.</li>
54 <li>Logger instances do not form a hierarchy.</li>
61 /** denotes the name of the logger.
63 [attribute
, readonly] string Name
;
65 /** specifies which log events are logged or ignored.
69 [attribute
] long Level
;
71 /** adds the given handler to the list of handlers.
73 <p>When an event is logged, the logger will create a <type>LogRecord</type>
74 for this event, and pass this record to all registered handlers. Single handlers
75 might or might not log those records at their own discretion, and depending on
76 additional restrictions such as filters specified at handler level.</p>
78 <p>Note: The log level of the given handler (<member>XLogHandler::Level</member>) will
79 not be touched. In particular, it will not be set to the logger's log level. It's
80 the responsibility of the component which knits a logger with one or more
81 log handlers to ensure that all loggers have appropriate levels set.</p>
84 the handler to add to the list of handlers. The call is ignored if this
87 void addLogHandler
( [in] XLogHandler LogHandler
);
89 /** removes the given handler from the list of handlers.
92 the handler to remove from the list of handlers. The call is ignored if this
93 parameter is <NULL/>, or if the handler has not previously beed added.
95 void removeLogHandler
( [in] XLogHandler LogHandler
);
97 /** determines whether logger instance would produce any output for the given level.
99 <p>The method can be used to optimize performance as maybe complex parameter evaluation
100 in the <code>log</code> calls can be omitted if <code>isLoggable</code> evaluates to false.</p>
103 level to be checked against
106 <TRUE/> if there would be some output for this XLogger for the given level, <FALSE/>
107 otherwise. Note that a return value of <FALSE/> could also indicate that the logger
108 does not have any log handlers associated with it.
111 @see removeLogHandler
113 boolean isLoggable
( [in] long Level
);
115 /** logs a given message
118 the log level of this message. If this level is smaller than the logger's <member>Level</member>
119 attribute, then the call will be ignored.
124 void log
( [in] long Level
, [in] string Message );
126 /** logs a given message, detailing the source class and method at which the logged
130 the log level of this message. If this level is smaller than the logger's <member>Level</member>
131 attribute, then the call will be ignored.
134 the source class at which the logged event occured.
137 the source class at which the logged event occured.
142 void logp
( [in] long Level
, [in] string SourceClassName
, [in] string SourceMethodName
, [in] string Message );
145 //=============================================================================
149 //=============================================================================