summaryrefslogtreecommitdiffstats
path: root/offapi/com/sun/star/logging/XLogger.idl
blob: 5ee092287e05bfa378d439295043a973fd925515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef __com_sun_star_logging_XLogger_idl__
#define __com_sun_star_logging_XLogger_idl__

#include <com/sun/star/uno/XInterface.idl>


module com { module sun { module star { module logging {

interface XLogHandler;


/** implemented by a component which is able to log events.

    <p>This interface is roughly designed after the
    <a href="http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html">Java
    Logging API</a>. However, there are some differences, the major ones being:
    <ul><li>There's no support (yet) for filtering log events.</li>
        <li>There ain't no convenience methods for logging.</li>
        <li>There's no localization support.</li>
        <li>Logger instances do not form a hierarchy.</li>
    </ul></p>

    @since OOo 2.3
 */
interface XLogger
{
    /** denotes the name of the logger.
    */
    [attribute, readonly]   string  Name;

    /** specifies which log events are logged or ignored.

        @see LogLevel
    */
    [attribute]   long Level;

    /** adds the given handler to the list of handlers.

        <p>When an event is logged, the logger will create a LogRecord
        for this event, and pass this record to all registered handlers. Single handlers
        might or might not log those records at their own discretion, and depending on
        additional restrictions such as filters specified at handler level.</p>

        <p>Note: The log level of the given handler (XLogHandler::Level) will
        not be touched. In particular, it will not be set to the logger's log level. It's
        the responsibility of the component which knits a logger with one or more
        log handlers to ensure that all loggers have appropriate levels set.</p>

        @param LogHandler
            the handler to add to the list of handlers. The call is ignored if this
            parameter is `NULL`.
    */
    void    addLogHandler( [in] XLogHandler LogHandler );

    /** removes the given handler from the list of handlers.

        @param LogHandler
            the handler to remove from the list of handlers. The call is ignored if this
            parameter is `NULL`, or if the handler has not previously been added.
    */
    void    removeLogHandler( [in] XLogHandler LogHandler );

    /** determines whether logger instance would produce any output for the given level.

        <p>The method can be used to optimize performance as maybe complex parameter evaluation
        in the <code>log</code> calls can be omitted if <code>isLoggable</code> evaluates to false.</p>

        @param Level
            level to be checked against

        @returns
            `TRUE` if there would be some output for this XLogger for the given level, `FALSE`
            otherwise. Note that a return value of `FALSE` could also indicate that the logger
            does not have any log handlers associated with it.

        @see addLogHandler
        @see removeLogHandler
    */
    boolean isLoggable( [in] long Level );

    /** logs a given message

        @param Level
            the log level of this message. If this level is smaller than the logger's #Level
            attribute, then the call will be ignored.

        @param Message
            the message to log
    */
    void    log( [in] long Level, [in] string Message );

    /** logs a given message, detailing the source class and method at which the logged
        event occurred.

        @param Level
            the log level of this message. If this level is smaller than the logger's #Level
            attribute, then the call will be ignored.

        @param SourceClass
            the source class at which the logged event occurred.

        @param SourceMethod
            the source class at which the logged event occurred.

        @param Message
            the message to log
    */
    void    logp( [in] long Level, [in] string SourceClass, [in] string SourceMethod, [in] string Message );
};


}; }; }; };


#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */