xref: /aoo41x/main/offapi/com/sun/star/logging/XLogger.idl (revision d1766043)
1*d1766043SAndrew Rist/**************************************************************
2*d1766043SAndrew Rist *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10*d1766043SAndrew Rist *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*d1766043SAndrew Rist *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19*d1766043SAndrew Rist *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_logging_XLogger_idl__
25cdf0e10cSrcweir#define __com_sun_star_logging_XLogger_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
28cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
29cdf0e10cSrcweir#endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir//=============================================================================
32cdf0e10cSrcweir
33cdf0e10cSrcweirmodule com { module sun { module star { module logging {
34cdf0e10cSrcweir
35cdf0e10cSrcweirpublished interface XLogHandler;
36cdf0e10cSrcweir
37cdf0e10cSrcweir//=============================================================================
38cdf0e10cSrcweir
39cdf0e10cSrcweir/** implemented by a component which is able to log events.
40cdf0e10cSrcweir
41cdf0e10cSrcweir    <p>This interface is roughly designed after the
42cdf0e10cSrcweir    <a href="http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html">Java
43cdf0e10cSrcweir    Logging API</a>. However, there are some differences, the major ones being:
44cdf0e10cSrcweir    <ul><li>There's no support (yet) for filtering log events.</li>
45cdf0e10cSrcweir        <li>There ain't no convenience menthods for logging.</li>
46cdf0e10cSrcweir        <li>There's no localization support.</li>
47cdf0e10cSrcweir        <li>Logger instances do not form a hierarchy.</li>
48cdf0e10cSrcweir    </ul></p>
49cdf0e10cSrcweir
50cdf0e10cSrcweir    @since OOo 2.3
51cdf0e10cSrcweir */
52cdf0e10cSrcweirpublished interface XLogger
53cdf0e10cSrcweir{
54cdf0e10cSrcweir    /** denotes the name of the logger.
55cdf0e10cSrcweir    */
56cdf0e10cSrcweir    [attribute, readonly]   string  Name;
57cdf0e10cSrcweir
58cdf0e10cSrcweir    /** specifies which log events are logged or ignored.
59cdf0e10cSrcweir
60cdf0e10cSrcweir        @see LogLevel
61cdf0e10cSrcweir    */
62cdf0e10cSrcweir    [attribute]   long Level;
63cdf0e10cSrcweir
64cdf0e10cSrcweir    /** adds the given handler to the list of handlers.
65cdf0e10cSrcweir
66cdf0e10cSrcweir        <p>When an event is logged, the logger will create a <type>LogRecord</type>
67cdf0e10cSrcweir        for this event, and pass this record to all registered handlers. Single handlers
68cdf0e10cSrcweir        might or might not log those records at their own discretion, and depending on
69cdf0e10cSrcweir        additional restrictions such as filters specified at handler level.</p>
70cdf0e10cSrcweir
71cdf0e10cSrcweir        <p>Note: The log level of the given handler (<member>XLogHandler::Level</member>) will
72cdf0e10cSrcweir        not be touched. In particular, it will not be set to the logger's log level. It's
73cdf0e10cSrcweir        the responsibility of the component which knits a logger with one or more
74cdf0e10cSrcweir        log handlers to ensure that all loggers have appropriate levels set.</p>
75cdf0e10cSrcweir
76cdf0e10cSrcweir        @param LogHandler
77cdf0e10cSrcweir            the handler to add to the list of handlers. The call is ignored if this
78cdf0e10cSrcweir            parameter is <NULL/>.
79cdf0e10cSrcweir    */
80cdf0e10cSrcweir    void    addLogHandler( [in] XLogHandler LogHandler );
81cdf0e10cSrcweir
82cdf0e10cSrcweir    /** removes the given handler from the list of handlers.
83cdf0e10cSrcweir
84cdf0e10cSrcweir        @param LogHandler
85cdf0e10cSrcweir            the handler to remove from the list of handlers. The call is ignored if this
86cdf0e10cSrcweir            parameter is <NULL/>, or if the handler has not previously beed added.
87cdf0e10cSrcweir    */
88cdf0e10cSrcweir    void    removeLogHandler( [in] XLogHandler LogHandler );
89cdf0e10cSrcweir
90cdf0e10cSrcweir    /** determines whether logger instance would produce any output for the given level.
91cdf0e10cSrcweir
92cdf0e10cSrcweir        <p>The method can be used to optimize performance as maybe complex parameter evaluation
93cdf0e10cSrcweir        in the <code>log</code> calls can be omitted if <code>isLoggable</code> evaluates to false.</p>
94cdf0e10cSrcweir
95cdf0e10cSrcweir        @param Level
96cdf0e10cSrcweir            level to be checked against
97cdf0e10cSrcweir
98cdf0e10cSrcweir        @returns
99cdf0e10cSrcweir            <TRUE/> if there would be some output for this XLogger for the given level, <FALSE/>
100cdf0e10cSrcweir            otherwise. Note that a return value of <FALSE/> could also indicate that the logger
101cdf0e10cSrcweir            does not have any log handlers associated with it.
102cdf0e10cSrcweir
103cdf0e10cSrcweir        @see addLogHandler
104cdf0e10cSrcweir        @see removeLogHandler
105cdf0e10cSrcweir    */
106cdf0e10cSrcweir    boolean isLoggable( [in] long Level );
107cdf0e10cSrcweir
108cdf0e10cSrcweir    /** logs a given message
109cdf0e10cSrcweir
110cdf0e10cSrcweir        @param Level
111cdf0e10cSrcweir            the log level of this message. If this level is smaller than the logger's <member>Level</member>
112cdf0e10cSrcweir            attribute, then the call will be ignored.
113cdf0e10cSrcweir
114cdf0e10cSrcweir        @param Message
115cdf0e10cSrcweir            the message to log
116cdf0e10cSrcweir    */
117cdf0e10cSrcweir    void    log( [in] long Level, [in] string Message );
118cdf0e10cSrcweir
119cdf0e10cSrcweir    /** logs a given message, detailing the source class and method at which the logged
120cdf0e10cSrcweir        event occured.
121cdf0e10cSrcweir
122cdf0e10cSrcweir        @param Level
123cdf0e10cSrcweir            the log level of this message. If this level is smaller than the logger's <member>Level</member>
124cdf0e10cSrcweir            attribute, then the call will be ignored.
125cdf0e10cSrcweir
126cdf0e10cSrcweir        @param SourceClass
127cdf0e10cSrcweir            the source class at which the logged event occured.
128cdf0e10cSrcweir
129cdf0e10cSrcweir        @param SourceMethod
130cdf0e10cSrcweir            the source class at which the logged event occured.
131cdf0e10cSrcweir
132cdf0e10cSrcweir        @param Message
133cdf0e10cSrcweir            the message to log
134cdf0e10cSrcweir    */
135cdf0e10cSrcweir    void    logp( [in] long Level, [in] string SourceClassName, [in] string SourceMethodName, [in] string Message );
136cdf0e10cSrcweir};
137cdf0e10cSrcweir
138cdf0e10cSrcweir//=============================================================================
139cdf0e10cSrcweir
140cdf0e10cSrcweir}; }; }; };
141cdf0e10cSrcweir
142cdf0e10cSrcweir//=============================================================================
143cdf0e10cSrcweir
144cdf0e10cSrcweir#endif
145