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