cid#1640468 Dereference after null check
[LibreOffice.git] / offapi / com / sun / star / logging / XLogger.idl
blobb36115ceb223a372410b0793ee6301906d6e088d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 module com { module sun { module star { module logging {
23 interface XLogHandler;
26 /** implemented by a component which is able to log events.
28 <p>This interface is roughly designed after the
29 <a href="http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html">Java
30 Logging API</a>. However, there are some differences, the major ones being:
31 <ul><li>There's no support (yet) for filtering log events.</li>
32 <li>There ain't no convenience methods for logging.</li>
33 <li>There's no localization support.</li>
34 <li>Logger instances do not form a hierarchy.</li>
35 </ul></p>
37 @since OOo 2.3
39 interface XLogger
41 /** denotes the name of the logger.
43 [attribute, readonly] string Name;
45 /** specifies which log events are logged or ignored.
47 @see LogLevel
49 [attribute] long Level;
51 /** adds the given handler to the list of handlers.
53 <p>When an event is logged, the logger will create a LogRecord
54 for this event, and pass this record to all registered handlers. Single handlers
55 might or might not log those records at their own discretion, and depending on
56 additional restrictions such as filters specified at handler level.</p>
58 <p>Note: The log level of the given handler (XLogHandler::Level) will
59 not be touched. In particular, it will not be set to the logger's log level. It's
60 the responsibility of the component which knits a logger with one or more
61 log handlers to ensure that all loggers have appropriate levels set.</p>
63 @param LogHandler
64 the handler to add to the list of handlers. The call is ignored if this
65 parameter is `NULL`.
67 void addLogHandler( [in] XLogHandler LogHandler );
69 /** removes the given handler from the list of handlers.
71 @param LogHandler
72 the handler to remove from the list of handlers. The call is ignored if this
73 parameter is `NULL`, or if the handler has not previously been added.
75 void removeLogHandler( [in] XLogHandler LogHandler );
77 /** determines whether logger instance would produce any output for the given level.
79 <p>The method can be used to optimize performance as maybe complex parameter evaluation
80 in the <code>log</code> calls can be omitted if <code>isLoggable</code> evaluates to false.</p>
82 @param Level
83 level to be checked against
85 @returns
86 `TRUE` if there would be some output for this XLogger for the given level, `FALSE`
87 otherwise. Note that a return value of `FALSE` could also indicate that the logger
88 does not have any log handlers associated with it.
90 @see addLogHandler
91 @see removeLogHandler
93 boolean isLoggable( [in] long Level );
95 /** logs a given message
97 @param Level
98 the log level of this message. If this level is smaller than the logger's #Level
99 attribute, then the call will be ignored.
101 @param Message
102 the message to log
104 void log( [in] long Level, [in] string Message );
106 /** logs a given message, detailing the source class and method at which the logged
107 event occurred.
109 @param Level
110 the log level of this message. If this level is smaller than the logger's #Level
111 attribute, then the call will be ignored.
113 @param SourceClass
114 the source class at which the logged event occurred.
116 @param SourceMethod
117 the source class at which the logged event occurred.
119 @param Message
120 the message to log
122 void logp( [in] long Level, [in] string SourceClass, [in] string SourceMethod, [in] string Message );
126 }; }; }; };
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */