From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001
From: Daniel Baumann The following settings are recognized and supported:
+ ConsoleHandler
+ create();
+
+ /** creates an instance of the log handler, using generic settings
+
+ @param Settings
+ contains the initial settings for the log handler
+
+ Encoding
- denotes the initial value of the XLogHandler::EncodingFormatter
- denotes the initial value of the XLogHandler::FormatterLevel
- denotes the initial value of the XLogHandler::LevelThreshold
- denotes the initial value of the XConsoleHandler::Threshold
Every log record, as passed to XCsvLogFormatter::format(), + will be formatted into a single row for a CSV file. + The sequence number, the thread ID, the time of the logged event, + the source class/method name will get logged alongside the message, if this + is not disabled. The Formatter also supports logging an arbitrary number of + user-defined columns. If the Formatter is configured to have more than one + (user-defined) column the data to log has to be preformatted with the + formatMultiColumn method.
+ + @since OOo 3.0 + */ +service CsvLogFormatter : XCsvLogFormatter +{ + /// creates a CsvLogFormatter instance + create(); +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/logging/FileHandler.idl b/offapi/com/sun/star/logging/FileHandler.idl new file mode 100644 index 000000000..3327df304 --- /dev/null +++ b/offapi/com/sun/star/logging/FileHandler.idl @@ -0,0 +1,83 @@ +/* -*- 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_FileHandler_idl__ +#define __com_sun_star_logging_FileHandler_idl__ + +#includeThe handler will use the Encoding
attribute of XLogHandler
+ to determine how to encode strings before actually writing them to the output
+ file.
$(userurl)
.
+ */
+ create( [in] string FileURL );
+
+ /** creates an instance of the log handler, using generic settings
+
+ @param Settings
+ contains the initial settings for the log handler
+
+ The following settings are recognized and supported: +
Encoding
- denotes the initial value of the XLogHandler::EncodingFormatter
- denotes the initial value of the XLogHandler::FormatterLevel
- denotes the initial value of the XLogHandler::LevelAdditionally, a setting name FileURL
is recognized. It must be of type
+ string, and denotes the file URL to which the handler's output should be directed.
At least the URL argument must be present in the settings.
+ + @throws ::com::sun::star::lang::IllegalArgumentException + if `Settings` contains settings whose value is of the wrong type. + */ + createWithSettings( [in] sequence< ::com::sun::star::beans::NamedValue > Settings ) + raises ( ::com::sun::star::lang::IllegalArgumentException ); +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/logging/LogLevel.idl b/offapi/com/sun/star/logging/LogLevel.idl new file mode 100644 index 000000000..dc3beaaa0 --- /dev/null +++ b/offapi/com/sun/star/logging/LogLevel.idl @@ -0,0 +1,77 @@ +/* -*- 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_LogLevel_idl__ +#define __com_sun_star_logging_LogLevel_idl__ + + +module com { module sun { module star { module logging { + + +/** specifies levels to distinguish between severities of logged events + + @see XLogger + + @since OOo 2.3 + */ +constants LogLevel +{ + /** specifies that no messages are to be logged at all + +This level can be set at an XLogger to completely prevent + logging. You will usually not use it with a concrete log event.
+ */ + const long OFF = 0x7FFFFFFF; + + /// denotes a serious failure to be logged + const long SEVERE = 1000; + + /// denotes a potential problem to be logged + const long WARNING = 900; + + /// denotes an informational message to be logged + const long INFO = 800; + + /// denotes a static configuration message to be logged + const long CONFIG = 700; + + /// denotes basic tracing information to be logged + const long FINE = 500; + + /// denotes more fine-grained tracing information to be logged + const long FINER = 400; + + /// denotes highly detailed tracing information to be logged + const long FINEST = 300; + + /** specifies that all messages should be logged + +This level can be set at an XLogger to enable logging + of absolutely all events. You will usually not use it with a concrete log event.
+ */ + const long ALL = -0x80000000; +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/logging/LogRecord.idl b/offapi/com/sun/star/logging/LogRecord.idl new file mode 100644 index 000000000..d0ae88e1b --- /dev/null +++ b/offapi/com/sun/star/logging/LogRecord.idl @@ -0,0 +1,84 @@ +/* -*- 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_LogRecord_idl__ +#define __com_sun_star_logging_LogRecord_idl__ + +#includelog
methods of XLogger did not specify it.
+ */
+ string SourceClassName;
+
+ /** specifies the name of the method, in which the record was logged.
+
+ This name might be empty, in case the caller to one of the various
+ log
methods of XLogger did not specify it.
+ */
+ string SourceMethodName;
+
+ /// specifies the to-be-logged message
+ string Message;
+
+ /// specifies the time at which the event was logged
+ ::com::sun::star::util::DateTime
+ LogTime;
+
+ /** specifies the number of the log event.
+
+ Subsequent events get assigned increasing sequence numbers by the XLogger
+ at which they're logged.
+ */
+ hyper SequenceNumber;
+
+ /// specifies the ID of the thread in which the event was logged
+ string ThreadID;
+
+ /** specifies the level of the log event
+
+ @see LogLevel
+ */
+ long Level;
+};
+
+
+}; }; }; };
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/logging/LoggerPool.idl b/offapi/com/sun/star/logging/LoggerPool.idl
new file mode 100644
index 000000000..cc9b5da8f
--- /dev/null
+++ b/offapi/com/sun/star/logging/LoggerPool.idl
@@ -0,0 +1,43 @@
+/* -*- 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_LoggerPool_idl__
+#define __com_sun_star_logging_LoggerPool_idl__
+
+#include The one and only LoggerPool
instance is available at a component context as value with the key
+ /singletons/com.sun.star.logging.LoggerPool
.
Every log record, as passed to XLogFormatter::format(), will + be formatted into a single text line, assembling the sequence number, the thread ID, + the time of the logged event, the source class/method name (if applicable), and the + log message.
+ + @since OOo 2.3 + */ +service PlainTextFormatter : XLogFormatter +{ + /// creates a PlainTextFormatter instance + create(); +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/logging/SimpleTextFormatter.idl b/offapi/com/sun/star/logging/SimpleTextFormatter.idl new file mode 100644 index 000000000..03aae22ef --- /dev/null +++ b/offapi/com/sun/star/logging/SimpleTextFormatter.idl @@ -0,0 +1,49 @@ +/* -*- 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_SimpleTextFormatter_idl__ +#define __com_sun_star_logging_SimpleTextFormatter_idl__ + + +module com { module sun { module star { module logging { + +interface XLogFormatter; + + +/** specifies a service which formats log records as single line plain text + +Every log record, as passed to XLogFormatter::format(), will + be formatted into a single text line, with just the log message being output. + If the loglevel is WARNING, or SEVERE, the line will be prefixed accordingly.
+ + @since LibreOffice 6.2 + */ +service SimpleTextFormatter : XLogFormatter +{ + /// creates a SimpleTextFormatter instance + create(); +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/logging/XConsoleHandler.idl b/offapi/com/sun/star/logging/XConsoleHandler.idl new file mode 100644 index 000000000..5d6ff6cba --- /dev/null +++ b/offapi/com/sun/star/logging/XConsoleHandler.idl @@ -0,0 +1,55 @@ +/* -*- 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_XConsoleHandler_idl__ +#define __com_sun_star_logging_XConsoleHandler_idl__ + +#includeNote that a console handler will ignore its formatter's head and tail, since
+ it cannot decided whether they should be emitted on stdout
or stderr
.
Events with a level greater or equal to Threshold
will be
+ logged to stderr
, all others to stdout
.
The default value for this attribute is LogLevel::SEVERE.
+ */ + [attribute] long Threshold; +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/logging/XCsvLogFormatter.idl b/offapi/com/sun/star/logging/XCsvLogFormatter.idl new file mode 100644 index 000000000..038f8c478 --- /dev/null +++ b/offapi/com/sun/star/logging/XCsvLogFormatter.idl @@ -0,0 +1,69 @@ +/* -*- 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_XCsvLogFormatter_idl__ +#define __com_sun_star_logging_XCsvLogFormatter_idl__ + +#includeformatMultiColumn
*/
+ [attribute] sequence< string > Columnnames;
+ /** if the CsvLogFormatter is set to have more than one
+ column, any logged information has to be send through this
+ method before calling log(). E.g.:
+
+ XLoggerInstance.log(1000, XCsvLogFormatterInstance.formatMultiColumn(columnData))
+ */
+ string formatMultiColumn( [in] sequence< string > columnData);
+};
+
+
+}; }; }; };
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/logging/XLogFormatter.idl b/offapi/com/sun/star/logging/XLogFormatter.idl
new file mode 100644
index 000000000..1bc474caa
--- /dev/null
+++ b/offapi/com/sun/star/logging/XLogFormatter.idl
@@ -0,0 +1,73 @@
+/* -*- 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_XLogFormatter_idl__
+#define __com_sun_star_logging_XLogFormatter_idl__
+
+#include This can be used to generate a header string, which by the XLogHandler + is emitted to its output channel before actually logging any concrete + LogRecord.
+ +For instance, a formatter might produce table-like plain text output, + and could return a table-head string (potentially including line breaks) + here.
+ */ + string getHead(); + + /** formats the given log record for output + +A XLogHandler will call this method to format a given
+ log record. The resulting string will be emitted to the handler's output
+ channel, without processing it any further (except possibly encoding it with
+ the handler's Encoding
).
This can be used to generate a footer string, which by the XLogHandler + is emitted to its output channel before it is finally being closed.
+ */ + string getTail(); +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/logging/XLogHandler.idl b/offapi/com/sun/star/logging/XLogHandler.idl new file mode 100644 index 000000000..cdb770c3b --- /dev/null +++ b/offapi/com/sun/star/logging/XLogHandler.idl @@ -0,0 +1,92 @@ +/* -*- 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_XLogHandler_idl__ +#define __com_sun_star_logging_XLogHandler_idl__ + +#includeDisposing the handler effectively means closing the channel + to which the handler forwards the log records. + */ + interface ::com::sun::star::lang::XComponent; + + /** specifies MIME charset name for the encoding to be used by this handler + +
It depends on the concrete handler implementation whether or not this + parameter is needed.
+ + @see http://www.iana.org/assignments/character-sets + */ + [attribute] string Encoding; + + /** specifies the formatter to be used by this handler. + */ + [attribute] XLogFormatter Formatter; + + /** specifies the log level of this handler + +
Different handlers can have different log levels, which again might be + different from the log level of the XLogger for which the handlers + are used.
+ */ + [attribute] long Level; + + /** flushes all buffered output of the handler + +Log handlers are allowed to buffer their output. Upon flush
+ being called, they must flush all their buffers.
This interface is roughly designed after the + Java + Logging API. However, there are some differences, the major ones being: +
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.
+ +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.
+ + @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. + +The method can be used to optimize performance as maybe complex parameter evaluation
+ in the log
calls can be omitted if isLoggable
evaluates to false.
Multiple attempts to retrieve a logger with the same name will return + the same instance.
+ +Newly created logger instances are initialized via configuration. See the configuration
+ module /org.openoffice.Office.Logging
for an explanation of the initialization
+ pattern.
Calling this method is equivalent to calling getNamedLogger( "org.openoffice.logging.DefaultLogger" )
.