1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28#ifndef __com_sun_star_logging_XLogger_idl__ 29#define __com_sun_star_logging_XLogger_idl__ 30 31#ifndef __com_sun_star_uno_XInterface_idl__ 32#include <com/sun/star/uno/XInterface.idl> 33#endif 34 35//============================================================================= 36 37module com { module sun { module star { module logging { 38 39published interface XLogHandler; 40 41//============================================================================= 42 43/** implemented by a component which is able to log events. 44 45 <p>This interface is roughly designed after the 46 <a href="http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html">Java 47 Logging API</a>. However, there are some differences, the major ones being: 48 <ul><li>There's no support (yet) for filtering log events.</li> 49 <li>There ain't no convenience menthods for logging.</li> 50 <li>There's no localization support.</li> 51 <li>Logger instances do not form a hierarchy.</li> 52 </ul></p> 53 54 @since OOo 2.3 55 */ 56published interface XLogger 57{ 58 /** denotes the name of the logger. 59 */ 60 [attribute, readonly] string Name; 61 62 /** specifies which log events are logged or ignored. 63 64 @see LogLevel 65 */ 66 [attribute] long Level; 67 68 /** adds the given handler to the list of handlers. 69 70 <p>When an event is logged, the logger will create a <type>LogRecord</type> 71 for this event, and pass this record to all registered handlers. Single handlers 72 might or might not log those records at their own discretion, and depending on 73 additional restrictions such as filters specified at handler level.</p> 74 75 <p>Note: The log level of the given handler (<member>XLogHandler::Level</member>) will 76 not be touched. In particular, it will not be set to the logger's log level. It's 77 the responsibility of the component which knits a logger with one or more 78 log handlers to ensure that all loggers have appropriate levels set.</p> 79 80 @param LogHandler 81 the handler to add to the list of handlers. The call is ignored if this 82 parameter is <NULL/>. 83 */ 84 void addLogHandler( [in] XLogHandler LogHandler ); 85 86 /** removes the given handler from the list of handlers. 87 88 @param LogHandler 89 the handler to remove from the list of handlers. The call is ignored if this 90 parameter is <NULL/>, or if the handler has not previously beed added. 91 */ 92 void removeLogHandler( [in] XLogHandler LogHandler ); 93 94 /** determines whether logger instance would produce any output for the given level. 95 96 <p>The method can be used to optimize performance as maybe complex parameter evaluation 97 in the <code>log</code> calls can be omitted if <code>isLoggable</code> evaluates to false.</p> 98 99 @param Level 100 level to be checked against 101 102 @returns 103 <TRUE/> if there would be some output for this XLogger for the given level, <FALSE/> 104 otherwise. Note that a return value of <FALSE/> could also indicate that the logger 105 does not have any log handlers associated with it. 106 107 @see addLogHandler 108 @see removeLogHandler 109 */ 110 boolean isLoggable( [in] long Level ); 111 112 /** logs a given message 113 114 @param Level 115 the log level of this message. If this level is smaller than the logger's <member>Level</member> 116 attribute, then the call will be ignored. 117 118 @param Message 119 the message to log 120 */ 121 void log( [in] long Level, [in] string Message ); 122 123 /** logs a given message, detailing the source class and method at which the logged 124 event occured. 125 126 @param Level 127 the log level of this message. If this level is smaller than the logger's <member>Level</member> 128 attribute, then the call will be ignored. 129 130 @param SourceClass 131 the source class at which the logged event occured. 132 133 @param SourceMethod 134 the source class at which the logged event occured. 135 136 @param Message 137 the message to log 138 */ 139 void logp( [in] long Level, [in] string SourceClassName, [in] string SourceMethodName, [in] string Message ); 140}; 141 142//============================================================================= 143 144}; }; }; }; 145 146//============================================================================= 147 148#endif 149