diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0058926 --- /dev/null +++ b/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + Log4cplus NAR package + com.googlecode.narlibs + log4cplus-nar + nar + 1.1.1 + + Log4cplus NAR packaging + + + + CERN + CERN Repository + https://repository.cern.ch/nexus/content/repositories/enice-releases + + + CERN Snapshot Repository + CERN Snapshot Repository + https://repository.cern.ch/nexus/content/repositories/enice-snapshots + + + + + + + org.apache.maven.plugins + maven-nar-plugin + 2.1-enice + true + + + + shared + + + + + + + diff --git a/src/nar/resources/aol/amd64-Linux-gpp/lib/liblog4cplus-nar-1.1.1.so b/src/nar/resources/aol/amd64-Linux-gpp/lib/liblog4cplus-nar-1.1.1.so new file mode 100644 index 0000000..401ac22 Binary files /dev/null and b/src/nar/resources/aol/amd64-Linux-gpp/lib/liblog4cplus-nar-1.1.1.so differ diff --git a/src/nar/resources/aol/amd64-Linux-gpp/lib/liblog4cplus.so b/src/nar/resources/aol/amd64-Linux-gpp/lib/liblog4cplus.so new file mode 100644 index 0000000..401ac22 Binary files /dev/null and b/src/nar/resources/aol/amd64-Linux-gpp/lib/liblog4cplus.so differ diff --git a/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus-nar-1.1.1.dll b/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus-nar-1.1.1.dll new file mode 100644 index 0000000..cf754f6 Binary files /dev/null and b/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus-nar-1.1.1.dll differ diff --git a/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus.dll b/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus.dll new file mode 100644 index 0000000..cf754f6 Binary files /dev/null and b/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus.dll differ diff --git a/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus.lib b/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus.lib new file mode 100644 index 0000000..eab2f6d Binary files /dev/null and b/src/nar/resources/aol/amd64-Windows-msvc/lib/log4cplus.lib differ diff --git a/src/nar/resources/aol/i386-Linux-gpp/lib/liblog4cplus-nar-1.1.1.so b/src/nar/resources/aol/i386-Linux-gpp/lib/liblog4cplus-nar-1.1.1.so new file mode 100644 index 0000000..e83a5f2 Binary files /dev/null and b/src/nar/resources/aol/i386-Linux-gpp/lib/liblog4cplus-nar-1.1.1.so differ diff --git a/src/nar/resources/aol/i386-Linux-gpp/lib/liblog4cplus.so b/src/nar/resources/aol/i386-Linux-gpp/lib/liblog4cplus.so new file mode 100644 index 0000000..e83a5f2 Binary files /dev/null and b/src/nar/resources/aol/i386-Linux-gpp/lib/liblog4cplus.so differ diff --git a/src/nar/resources/aol/x86-Windows-msvc/lib/log4cplus.dll b/src/nar/resources/aol/x86-Windows-msvc/lib/log4cplus.dll new file mode 100644 index 0000000..774ff46 Binary files /dev/null and b/src/nar/resources/aol/x86-Windows-msvc/lib/log4cplus.dll differ diff --git a/src/nar/resources/aol/x86-Windows-msvc/lib/log4cplus.lib b/src/nar/resources/aol/x86-Windows-msvc/lib/log4cplus.lib new file mode 100644 index 0000000..b6b34e4 Binary files /dev/null and b/src/nar/resources/aol/x86-Windows-msvc/lib/log4cplus.lib differ diff --git a/src/nar/resources/noarch/include/log4cplus/appender.h b/src/nar/resources/noarch/include/log4cplus/appender.h new file mode 100644 index 0000000..051dcec --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/appender.h @@ -0,0 +1,276 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: appender.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_APPENDER_HEADER_ +#define LOG4CPLUS_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include + +#include + + +namespace log4cplus { + + + namespace helpers + { + + class Properties; + + } + + + /** + * This class is used to "handle" errors encountered in an {@link + * log4cplus::Appender}. + */ + class LOG4CPLUS_EXPORT ErrorHandler + { + public: + ErrorHandler (); + virtual ~ErrorHandler() = 0; + virtual void error(const log4cplus::tstring& err) = 0; + virtual void reset() = 0; + }; + + + class LOG4CPLUS_EXPORT OnlyOnceErrorHandler + : public ErrorHandler + { + public: + // Ctor + OnlyOnceErrorHandler(); + virtual ~OnlyOnceErrorHandler (); + virtual void error(const log4cplus::tstring& err); + virtual void reset(); + + private: + bool firstTime; + }; + + + /** + * Extend this class for implementing your own strategies for printing log + * statements. + * + *

Properties

+ *
+ * + *
layout
+ *
This property specifies message layout used by + * Appender. + * \sa Layout + *
+ * + *
filters
+ *
This property specifies possibly multiple filters used by + * Appender. Each of multple filters and its properties is under a + * numbered subkey of filters key. E.g.: + * filters.1=log4cplus::spi::LogLevelMatchFilter. Filter + * subkey numbers must be consecutive.
+ * + *
Threshold
+ *
This property specifies log level threshold. Events with + * lower log level than the threshold will not be logged by + * appender.
+ * + *
UseLockFile
+ *
Set this property to true if you want your output + * through this appender to be synchronized between multiple + * processes. When this property is set to true then log4cplus + * uses OS specific facilities (e.g., lockf()) to + * provide inter-process locking. With the exception of + * FileAppender and its derived classes, it is also necessary to + * provide path to a lock file using the LockFile + * property. + * \sa FileAppender + *
+ * + *
LockFile
+ *
This property specifies lock file, file used for + * inter-process synchronization of log file access. The property + * is only used when UseLockFile is set to true. Then it + * is mandatory. + * \sa FileAppender + *
+ *
+ */ + class LOG4CPLUS_EXPORT Appender + : public virtual log4cplus::helpers::SharedObject + { + public: + // Ctor + Appender(); + Appender(const log4cplus::helpers::Properties & properties); + + // Dtor + virtual ~Appender(); + + void destructorImpl(); + + // Methods + /** + * Release any resources allocated within the appender such as file + * handles, network connections, etc. + * + * It is a programming error to append to a closed appender. + */ + virtual void close() = 0; + + /** + * This method performs threshold checks and invokes filters before + * delegating actual logging to the subclasses specific {@link + * #append} method. + */ + void doAppend(const log4cplus::spi::InternalLoggingEvent& event); + + /** + * Get the name of this appender. The name uniquely identifies the + * appender. + */ + virtual log4cplus::tstring getName(); + + /** + * Set the name of this appender. The name is used by other + * components to identify this appender. + */ + virtual void setName(const log4cplus::tstring& name); + + /** + * Set the {@link ErrorHandler} for this Appender. + */ + virtual void setErrorHandler(std::auto_ptr eh); + + /** + * Return the currently set {@link ErrorHandler} for this + * Appender. + */ + virtual ErrorHandler* getErrorHandler(); + + /** + * Set the layout for this appender. Note that some appenders have + * their own (fixed) layouts or do not use one. For example, the + * SocketAppender ignores the layout set here. + */ + virtual void setLayout(std::auto_ptr layout); + + /** + * Returns the layout of this appender. The value may be NULL. + * + * This class owns the returned pointer. + */ + virtual Layout* getLayout(); + + /** + * Set the filter chain on this Appender. + */ + void setFilter(log4cplus::spi::FilterPtr f) { filter = f; } + + /** + * Get the filter chain on this Appender. + */ + log4cplus::spi::FilterPtr getFilter() const { return filter; } + + /** + * Returns this appenders threshold LogLevel. See the {@link + * #setThreshold} method for the meaning of this option. + */ + LogLevel getThreshold() const { return threshold; } + + /** + * Set the threshold LogLevel. All log events with lower LogLevel + * than the threshold LogLevel are ignored by the appender. + * + * In configuration files this option is specified by setting the + * value of the Threshold option to a LogLevel + * string, such as "DEBUG", "INFO" and so on. + */ + void setThreshold(LogLevel th) { threshold = th; } + + /** + * Check whether the message LogLevel is below the appender's + * threshold. If there is no threshold set, then the return value is + * always true. + */ + bool isAsSevereAsThreshold(LogLevel ll) const { + return ((ll != NOT_SET_LOG_LEVEL) && (ll >= threshold)); + } + + protected: + // Methods + /** + * Subclasses of Appender should implement this + * method to perform actual logging. + * @see doAppend method. + */ + virtual void append(const log4cplus::spi::InternalLoggingEvent& event) = 0; + + tstring & formatEvent (const log4cplus::spi::InternalLoggingEvent& event) const; + + // Data + /** The layout variable does not need to be set if the appender + * implementation has its own layout. */ + std::auto_ptr layout; + + /** Appenders are named. */ + log4cplus::tstring name; + + /** There is no LogLevel threshold filtering by default. */ + LogLevel threshold; + + /** The first filter in the filter chain. Set to null + * initially. */ + log4cplus::spi::FilterPtr filter; + + /** It is assumed and enforced that errorHandler is never null. */ + std::auto_ptr errorHandler; + + //! Optional system wide synchronization lock. + std::auto_ptr lockFile; + + //! Use lock file for inter-process synchronization of access + //! to log file. + bool useLockFile; + + /** Is this appender closed? */ + bool closed; + }; + + /** This is a pointer to an Appender. */ + typedef helpers::SharedObjectPtr SharedAppenderPtr; + +} // end namespace log4cplus + +#endif // LOG4CPLUS_APPENDER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/asyncappender.h b/src/nar/resources/noarch/include/log4cplus/asyncappender.h new file mode 100644 index 0000000..af9d5e5 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/asyncappender.h @@ -0,0 +1,90 @@ +// -*- C++ -*- +// Module: Log4cplus +// File: asyncappender.h +// Created: 1/2009 +// Author: Vaclav Haisman +// +// +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +// + +/** @file */ + +#ifndef LOG4CPLUS_ASYNCAPPENDER_H +#define LOG4CPLUS_ASYNCAPPENDER_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#ifndef LOG4CPLUS_SINGLE_THREADED + +#include +#include +#include +#include + + +namespace log4cplus +{ + + +class LOG4CPLUS_EXPORT AsyncAppender + : public Appender + , public helpers::AppenderAttachableImpl +{ +public: + AsyncAppender (SharedAppenderPtr const & app, unsigned max_len); + AsyncAppender (helpers::Properties const &); + virtual ~AsyncAppender (); + + virtual void close (); + +protected: + virtual void append (spi::InternalLoggingEvent const &); + + void init_queue_thread (unsigned); + + thread::AbstractThreadPtr queue_thread; + thread::QueuePtr queue; + +private: + AsyncAppender (AsyncAppender const &); + AsyncAppender & operator = (AsyncAppender const &); +}; + + +typedef helpers::SharedObjectPtr AsyncAppenderPtr; + + +} // namespace log4cplus + + +#endif // LOG4CPLUS_SINGLE_THREADED + +#endif // LOG4CPLUS_ASYNCAPPENDER_H diff --git a/src/nar/resources/noarch/include/log4cplus/boost/deviceappender.hxx b/src/nar/resources/noarch/include/log4cplus/boost/deviceappender.hxx new file mode 100644 index 0000000..e31fc79 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/boost/deviceappender.hxx @@ -0,0 +1,201 @@ +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_BOOST_DEVICEAPPENDER_HXX +#define LOG4CPLUS_BOOST_DEVICEAPPENDER_HXX + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include + + +namespace log4cplus +{ + + +namespace device_appender_detail +{ + + +template +struct device_type_traits +{ + typedef T & device_type; + + static + device_type + unwrap (device_type x) + { + return x; + } +}; + + +template +struct device_type_traits > +{ + typedef boost::shared_ptr device_type; + + static + T & + unwrap (device_type const & ptr) + { + return *ptr; + } +}; + + +} // namespace device_appender_detail + + +template +class DeviceAppender + : public Appender +{ +public: + typedef device_appender_detail::device_type_traits device_traits; + typedef typename device_traits::device_type device_type; + + template + DeviceAppender (D & d, bool close_device = true) + : device (d) + , close_flag (close_device) + { } + + template + DeviceAppender (boost::shared_ptr const & d, bool close_device = true) + : device (d) + , close_flag (close_device) + { } + + template + DeviceAppender (D & d, const helpers::Properties & props) + : Appender (props) + , device (d) + { + if (props.exists (LOG4CPLUS_TEXT ("CloseDevice"))) + close_flag = true; + else + close_flag = false; + } + + template + DeviceAppender (boost::shared_ptr const & d, + const helpers::Properties & props) + : Appender (props) + , device (d) + { + if (props.exists (LOG4CPLUS_TEXT ("CloseDevice"))) + close_flag = true; + else + close_flag = false; + } + + virtual + ~DeviceAppender () + { } + + virtual + void + close () + { + if (close_flag) + boost::iostreams::close (device_traits::unwrap (device)); + } + +protected: + virtual + void + append (log4cplus::spi::InternalLoggingEvent const & event) + { + tstring & str = formatEvent (event); + boost::iostreams::write (device_traits::unwrap (device), + str.c_str (), str.size ()); + } + + device_type device; + bool close_flag; + +private: + DeviceAppender (DeviceAppender const &); + DeviceAppender & operator = (DeviceAppender const &); +}; + + +template +inline +SharedAppenderPtr +make_device_appender (T & d, bool close_device = true) +{ + SharedAppenderPtr app (new DeviceAppender (d, close_device)); + return app; +} + + +template +inline +SharedAppenderPtr +make_device_appender (T & d, const helpers::Properties & props) +{ + SharedAppenderPtr app (new DeviceAppender (d, props)); + return app; +} + + +template +inline +SharedAppenderPtr +make_device_appender_sp (boost::shared_ptr const & p, + bool close_device = true) +{ + SharedAppenderPtr app ( + new DeviceAppender > (p, close_device)); + return app; +} + + +template +inline +SharedAppenderPtr +make_device_appender_sp (boost::shared_ptr const & p, + const helpers::Properties & props) +{ + SharedAppenderPtr app ( + new DeviceAppender > (p, props)); + return app; +} + + +} // namespace log4cplus + + +#endif // LOG4CPLUS_BOOST_DEVICEAPPENDER_HXX diff --git a/src/nar/resources/noarch/include/log4cplus/clfsappender.h b/src/nar/resources/noarch/include/log4cplus/clfsappender.h new file mode 100644 index 0000000..ca46b69 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/clfsappender.h @@ -0,0 +1,98 @@ +// -*- C++ -*- +// Module: Log4cplus +// File: clfsappender.h +// Created: 5/2012 +// Author: Vaclav Zeman +// +// +// Copyright (C) 2012-2013, Vaclav Zeman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +// + +/** @file */ + +#ifndef LOG4CPLUS_CLFSAPPENDER_H +#define LOG4CPLUS_CLFSAPPENDER_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + + +#if defined (LOG4CPLUS_CLFSAPPENDER_BUILD_DLL) +# if defined (INSIDE_LOG4CPLUS_CLFSAPPENDER) +# define LOG4CPLUS_CLFSAPPENDER_EXPORT __declspec(dllexport) +# else +# define LOG4CPLUS_CLFSAPPENDER_EXPORT __declspec(dllimport) +# endif +#else +# define LOG4CPLUS_CLFSAPPENDER_EXPORT +#endif + + +namespace log4cplus +{ + + +class LOG4CPLUS_CLFSAPPENDER_EXPORT CLFSAppender + : public Appender +{ +public: + CLFSAppender (tstring const & logname, unsigned long logsize, + unsigned long buffersize); + explicit CLFSAppender (helpers::Properties const &); + virtual ~CLFSAppender (); + + virtual void close (); + + static void registerAppender (); + +protected: + virtual void append (spi::InternalLoggingEvent const &); + + void init (tstring const & logname, unsigned long logsize, + unsigned long buffersize); + + struct Data; + + Data * data; + +private: + CLFSAppender (CLFSAppender const &); + CLFSAppender & operator = (CLFSAppender const &); +}; + + +typedef helpers::SharedObjectPtr CLFSAppenderPtr; + + +} // namespace log4cplus + + +#endif // LOG4CPLUS_CLFSAPPENDER_H diff --git a/src/nar/resources/noarch/include/log4cplus/clogger.h b/src/nar/resources/noarch/include/log4cplus/clogger.h new file mode 100644 index 0000000..a340d1b --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/clogger.h @@ -0,0 +1,85 @@ +// -*- C -*- +/** + * Module: Log4CPLUS + * File: clogger.h + * Created: 01/2011 + * Author: Jens Rehsack + * + * + * Copyright 2011-2013 Jens Rehsack & Tad E. Smith + * + * Licensed 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** @file + * This header defines the C API for log4cplus and the logging macros. */ + +#ifndef LOG4CPLUS_CLOGGERHEADER_ +#define LOG4CPLUS_CLOGGERHEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + + +#ifdef __cplusplus +extern "C" +{ +#endif + +// TODO UNICDE capable + +typedef void *logger_t; +typedef int loglevel_t; + +#define L4CP_OFF_LOG_LEVEL 60000 +#define L4CP_FATAL_LOG_LEVEL 50000 +#define L4CP_ERROR_LOG_LEVEL 40000 +#define L4CP_WARN_LOG_LEVEL 30000 +#define L4CP_INFO_LOG_LEVEL 20000 +#define L4CP_DEBUG_LOG_LEVEL 10000 +#define L4CP_TRACE_LOG_LEVEL 0 +#define L4CP_ALL_LOG_LEVEL TRACE_LOG_LEVEL +#define L4CP_NOT_SET_LOG_LEVEL -1 + +#ifdef UNICODE +# define LOG4CPLUS_TEXT2(STRING) L##STRING +typedef wchar_t log4cplus_char_t; +#else +# define LOG4CPLUS_TEXT2(STRING) STRING +typedef char log4cplus_char_t; +#endif // UNICODE +#define LOG4CPLUS_TEXT(STRING) LOG4CPLUS_TEXT2(STRING) + +LOG4CPLUS_EXPORT int log4cplus_file_configure(const log4cplus_char_t *pathname); +LOG4CPLUS_EXPORT int log4cplus_str_configure(const log4cplus_char_t *config); +LOG4CPLUS_EXPORT int log4cplus_basic_configure(void); +LOG4CPLUS_EXPORT void log4cplus_shutdown(void); + +LOG4CPLUS_EXPORT int log4cplus_logger_exists(const log4cplus_char_t *name); +LOG4CPLUS_EXPORT int log4cplus_logger_is_enabled_for( + const log4cplus_char_t *name, loglevel_t ll); +LOG4CPLUS_EXPORT int log4cplus_logger_log(const log4cplus_char_t *name, + loglevel_t ll, const log4cplus_char_t *msgfmt, ...) + LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4); +LOG4CPLUS_EXPORT int log4cplus_logger_force_log(const log4cplus_char_t *name, + loglevel_t ll, const log4cplus_char_t *msgfmt, ...) + LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 4); + +#ifdef __cplusplus +} +#endif + +#endif /*?LOG4CPLUS_CLOGGERHEADER_*/ diff --git a/src/nar/resources/noarch/include/log4cplus/config.h.cmake.in b/src/nar/resources/noarch/include/log4cplus/config.h.cmake.in new file mode 100644 index 0000000..3ba79af --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config.h.cmake.in @@ -0,0 +1,347 @@ +/* include/log4cplus/config.h.in. Generated from configure.in by autoheader. */ + +#ifndef LOG4CPLUS_CONFIG_H + +#define LOG4CPLUS_CONFIG_H + +/* Defined if the compiler supports C99 style variadic macros with + __VA_ARGS__. */ +/* #undef HAS_C99_VARIADIC_MACROS */ + +/* Defined if the compiler supports GNU style variadic macros. */ +/* #undef HAS_GNU_VARIADIC_MACROS */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `ftime' function. */ +#cmakedefine HAVE_FTIME 1 + +/* */ +#cmakedefine HAVE_GETADDRINFO 1 + +/* */ +#cmakedefine HAVE_GETHOSTBYNAME_R 1 + +/* Define to 1 if you have the `getpid' function. */ +#cmakedefine HAVE_GETPID 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#cmakedefine HAVE_GMTIME_R 1 + +/* Define to 1 if you have the `htonl' function. */ +#cmakedefine HAVE_HTONL 1 + +/* Define to 1 if you have the `htons' function. */ +#cmakedefine HAVE_HTONS 1 + +/* Define to 1 if you have the `iconv' function. */ +#cmakedefine HAVE_ICONV 1 + +/* Define to 1 if you have the `iconv_close' function. */ +#cmakedefine HAVE_ICONV_CLOSE 1 + +/* Define to 1 if you have the `iconv_open' function. */ +#cmakedefine HAVE_ICONV_OPEN 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `advapi32' library (-ladvapi32). */ +#cmakedefine HAVE_LIBADVAPI32 1 + +/* Define to 1 if you have the `libiconv' function. */ +/* #undef HAVE_LIBICONV */ + +/* Define to 1 if you have the `libiconv_close' function. */ +/* #undef HAVE_LIBICONV_CLOSE */ + +/* Define to 1 if you have the `libiconv_open' function. */ +/* #undef HAVE_LIBICONV_OPEN */ + +/* Define to 1 if you have the `kernel32' library (-lkernel32). */ +#cmakedefine HAVE_LIBKERNEL32 1 + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#cmakedefine HAVE_LIBNSL 1 + +/* Define to 1 if you have the `rt' library (-lrt). */ +#cmakedefine HAVE_LIBRT 1 + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#cmakedefine HAVE_LIBSOCKET 1 + +/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ +#cmakedefine HAVE_LIBWS2_32 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#cmakedefine HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the `lstat' function. */ +#cmakedefine HAVE_LSTAT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `ntohl' function. */ +#cmakedefine HAVE_NTOHL 1 + +/* Define to 1 if you have the `ntohs' function. */ +#cmakedefine HAVE_NTOHS 1 + +/* Define if you have POSIX threads libraries and header files. */ +#undef HAVE_PTHREAD + +/* Define to 1 if you have the `stat' function. */ +#cmakedefine HAVE_STAT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vfprintf_s' function. */ +#cmakedefine HAVE_VFPRINTF_S 1 + +/* Define to 1 if you have the `vfwprintf_s' function. */ +#cmakedefine HAVE_VFWPRINTF_S 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#cmakedefine HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the `vsprintf_s' function. */ +#cmakedefine HAVE_VSPRINTF_S 1 + +/* Define to 1 if you have the `vswprintf_s' function. */ +#cmakedefine HAVE_VSWPRINTF_S 1 + +/* Define to 1 if you have the `_vsnprintf' function. */ +#cmakedefine HAVE__VSNPRINTF 1 + +/* Define to 1 if you have the `_vsnprintf_s' function. */ +#cmakedefine HAVE__VSNPRINTF_S 1 + +/* Define to 1 if you have the `_vsnwprintf_s' function. */ +#cmakedefine HAVE__VSNWPRINTF_S 1 + +/* Defined if the compiler supports __FUNCTION__ macro. */ +#cmakedefine HAVE___FUNCTION___MACRO 1 + +/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */ +#cmakedefine HAVE___PRETTY_FUNCTION___MACRO 1 + +/* Defined if the compiler provides __sync_add_and_fetch(). */ +#cmakedefine HAVE___SYNC_ADD_AND_FETCH 1 + +/* Defined if the compiler provides __sync_sub_and_fetch(). */ +#cmakedefine HAVE___SYNC_SUB_AND_FETCH 1 + +/* Defined for --enable-debugging builds. */ +#undef LOG4CPLUS_DEBUGGING + +/* Defined if the compiler understands __declspec(dllimport) or + __attribute__((visibility("default"))) construct. */ +#define LOG4CPLUS_DECLSPEC_EXPORT @LOG4CPLUS_DECLSPEC_EXPORT@ + +/* Defined if the compiler understands __declspec(dllexport) or construct. */ +#define LOG4CPLUS_DECLSPEC_IMPORT @LOG4CPLUS_DECLSPEC_IMPORT@ /**/ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_C99_VARIADIC_MACROS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_CLOCK_GETTIME 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ENAMETOOLONG 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ERRNO_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FTIME 1 + +/* */ +#define LOG4CPLUS_HAVE_FUNCTION_MACRO 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETADDRINFO 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETHOSTBYNAME_R 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETPID 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETTID 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETTIMEOFDAY 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GMTIME_R 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_HTONL 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_HTONS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ICONV 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_CLOSE 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_OPEN 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LIMITS_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LOCALTIME_R 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LSTAT 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETDB_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETINET_IN_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETINET_TCP_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NTOHL 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NTOHS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STAT 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDARG_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDIO_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDLIB_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYSLOG_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_SOCKET_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_STAT_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_SYSCALL_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TIMEB_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TIME_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TYPES_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_TIME_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_UNISTD_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_VFPRINTF_S 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_VFWPRINTF_S 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_VSNPRINTF 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_VSPRINTF_S 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_VSWPRINTF_S 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_WCHAR_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF_S 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE__VSNWPRINTF_S 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH 1 + +/* Define if this is a single-threaded library. */ +#undef LOG4CPLUS_SINGLE_THREADED + +/* */ +#undef LOG4CPLUS_USE_PTHREADS + +/* Define for compilers/standard libraries that support more than just the "C" + locale. */ +#undef LOG4CPLUS_WORKING_LOCALE + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* Define to 1 if you have the ANSI C header files. Seems to be unused*/ +#cmakedefine STDC_HEADERS 1 + +/* Define to int if undefined. */ +#cmakedefine socklen_t int + +#endif // LOG4CPLUS_CONFIG_H diff --git a/src/nar/resources/noarch/include/log4cplus/config.h.in b/src/nar/resources/noarch/include/log4cplus/config.h.in new file mode 100644 index 0000000..c6e6eb4 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config.h.in @@ -0,0 +1,479 @@ +/* include/log4cplus/config.h.in. Generated from configure.ac by autoheader. */ + +#ifndef LOG4CPLUS_CONFIG_H + +#define LOG4CPLUS_CONFIG_H + +/* Defined if the compiler supports C99 style variadic macros with + __VA_ARGS__. */ +#undef HAS_C99_VARIADIC_MACROS + +/* Defined if the compiler supports GNU style variadic macros. */ +#undef HAS_GNU_VARIADIC_MACROS + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the `clock_nanosleep' function. */ +#undef HAVE_CLOCK_NANOSLEEP + +/* Defined if the compiler provides C++11 header and increment, + decrement operations. */ +#undef HAVE_CXX11_ATOMICS + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + +/* Define to 1 if you have the `flock' function. */ +#undef HAVE_FLOCK + +/* Define to 1 if you have the `ftime' function. */ +#undef HAVE_FTIME + +/* */ +#undef HAVE_GETADDRINFO + +/* */ +#undef HAVE_GETHOSTBYNAME_R + +/* Define to 1 if you have the `getpid' function. */ +#undef HAVE_GETPID + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R + +/* Define to 1 if you have the `htonl' function. */ +#undef HAVE_HTONL + +/* Define to 1 if you have the `htons' function. */ +#undef HAVE_HTONS + +/* Define to 1 if you have the `iconv' function. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the `iconv_close' function. */ +#undef HAVE_ICONV_CLOSE + +/* Define to 1 if you have the `iconv_open' function. */ +#undef HAVE_ICONV_OPEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `advapi32' library (-ladvapi32). */ +#undef HAVE_LIBADVAPI32 + +/* Define to 1 if you have the `libiconv' function. */ +#undef HAVE_LIBICONV + +/* Define to 1 if you have the `libiconv_close' function. */ +#undef HAVE_LIBICONV_CLOSE + +/* Define to 1 if you have the `libiconv_open' function. */ +#undef HAVE_LIBICONV_OPEN + +/* Define to 1 if you have the `kernel32' library (-lkernel32). */ +#undef HAVE_LIBKERNEL32 + +/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ +#undef HAVE_LIBWS2_32 + +/* Define to 1 if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + +/* Define to 1 if you have the `lockf' function. */ +#undef HAVE_LOCKF + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if you have the `mbstowcs' function. */ +#undef HAVE_MBSTOWCS + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `nanosleep' function. */ +#undef HAVE_NANOSLEEP + +/* Define to 1 if you have the `ntohl' function. */ +#undef HAVE_NTOHL + +/* Define to 1 if you have the `ntohs' function. */ +#undef HAVE_NTOHS + +/* Define to 1 if you have the `pipe' function. */ +#undef HAVE_PIPE + +/* Define to 1 if you have the `pipe2' function. */ +#undef HAVE_PIPE2 + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define if you have POSIX threads libraries and header files. */ +#undef HAVE_PTHREAD + +/* Have PTHREAD_PRIO_INHERIT. */ +#undef HAVE_PTHREAD_PRIO_INHERIT + +/* Define to 1 if you have the `stat' function. */ +#undef HAVE_STAT + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Defined if the compiler understands __thread or __declspec(thread) + construct. */ +#undef HAVE_TLS_SUPPORT + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfprintf_s' function. */ +#undef HAVE_VFPRINTF_S + +/* Define to 1 if you have the `vfwprintf_s' function. */ +#undef HAVE_VFWPRINTF_S + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `vsnwprintf' function. */ +#undef HAVE_VSNWPRINTF + +/* Define to 1 if you have the `vsprintf_s' function. */ +#undef HAVE_VSPRINTF_S + +/* Define to 1 if you have the `vswprintf_s' function. */ +#undef HAVE_VSWPRINTF_S + +/* Define to 1 if you have the `wcstombs' function. */ +#undef HAVE_WCSTOMBS + +/* Define to 1 if you have the `_vsnprintf_s' function. */ +#undef HAVE__VSNPRINTF_S + +/* Define to 1 if you have the `_vsnwprintf' function. */ +#undef HAVE__VSNWPRINTF + +/* Define to 1 if you have the `_vsnwprintf_s' function. */ +#undef HAVE__VSNWPRINTF_S + +/* Defined if the compiler supports __FUNCTION__ macro. */ +#undef HAVE___FUNCTION___MACRO + +/* Defined if the compiler supports __func__ symbol. */ +#undef HAVE___FUNC___SYMBOL + +/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */ +#undef HAVE___PRETTY_FUNCTION___MACRO + +/* Defined if the compiler provides __sync_add_and_fetch(). */ +#undef HAVE___SYNC_ADD_AND_FETCH + +/* Defined if the compiler provides __sync_sub_and_fetch(). */ +#undef HAVE___SYNC_SUB_AND_FETCH + +/* Defined for --enable-debugging builds. */ +#undef LOG4CPLUS_DEBUGGING + +/* Defined if the compiler understands __declspec(dllimport) or + __attribute__((visibility("default"))) or __global construct. */ +#undef LOG4CPLUS_DECLSPEC_EXPORT + +/* Defined if the compiler understands __declspec(dllimport) or + __attribute__((visibility("default"))) or __global construct. */ +#undef LOG4CPLUS_DECLSPEC_IMPORT + +/* Defined if the compiler understands __attribute__((visibility("hidden"))) + or __hidden construct. */ +#undef LOG4CPLUS_DECLSPEC_PRIVATE + +/* */ +#undef LOG4CPLUS_HAVE_ARPA_INET_H + +/* */ +#undef LOG4CPLUS_HAVE_C99_VARIADIC_MACROS + +/* */ +#undef LOG4CPLUS_HAVE_CLOCK_GETTIME + +/* */ +#undef LOG4CPLUS_HAVE_CLOCK_NANOSLEEP + +/* */ +#undef LOG4CPLUS_HAVE_CXX11_ATOMICS + +/* */ +#undef LOG4CPLUS_HAVE_ENAMETOOLONG + +/* */ +#undef LOG4CPLUS_HAVE_ERRNO_H + +/* */ +#undef LOG4CPLUS_HAVE_FCNTL + +/* */ +#undef LOG4CPLUS_HAVE_FCNTL_H + +/* */ +#undef LOG4CPLUS_HAVE_FLOCK + +/* */ +#undef LOG4CPLUS_HAVE_FTIME + +/* */ +#undef LOG4CPLUS_HAVE_FUNCTION_MACRO + +/* */ +#undef LOG4CPLUS_HAVE_FUNC_SYMBOL + +/* */ +#undef LOG4CPLUS_HAVE_GETADDRINFO + +/* */ +#undef LOG4CPLUS_HAVE_GETHOSTBYNAME_R + +/* */ +#undef LOG4CPLUS_HAVE_GETPID + +/* */ +#undef LOG4CPLUS_HAVE_GETTID + +/* */ +#undef LOG4CPLUS_HAVE_GETTIMEOFDAY + +/* */ +#undef LOG4CPLUS_HAVE_GMTIME_R + +/* */ +#undef LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS + +/* */ +#undef LOG4CPLUS_HAVE_HTONL + +/* */ +#undef LOG4CPLUS_HAVE_HTONS + +/* */ +#undef LOG4CPLUS_HAVE_ICONV + +/* */ +#undef LOG4CPLUS_HAVE_ICONV_CLOSE + +/* */ +#undef LOG4CPLUS_HAVE_ICONV_H + +/* */ +#undef LOG4CPLUS_HAVE_ICONV_OPEN + +/* */ +#undef LOG4CPLUS_HAVE_LIMITS_H + +/* */ +#undef LOG4CPLUS_HAVE_LOCALTIME_R + +/* */ +#undef LOG4CPLUS_HAVE_LOCKF + +/* */ +#undef LOG4CPLUS_HAVE_LSTAT + +/* */ +#undef LOG4CPLUS_HAVE_MBSTOWCS + +/* */ +#undef LOG4CPLUS_HAVE_NANOSLEEP + +/* */ +#undef LOG4CPLUS_HAVE_NETDB_H + +/* */ +#undef LOG4CPLUS_HAVE_NETINET_IN_H + +/* */ +#undef LOG4CPLUS_HAVE_NETINET_TCP_H + +/* */ +#undef LOG4CPLUS_HAVE_NTOHL + +/* */ +#undef LOG4CPLUS_HAVE_NTOHS + +/* */ +#undef LOG4CPLUS_HAVE_PIPE + +/* */ +#undef LOG4CPLUS_HAVE_PIPE2 + +/* */ +#undef LOG4CPLUS_HAVE_POLL + +/* */ +#undef LOG4CPLUS_HAVE_POLL_H + +/* */ +#undef LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO + +/* */ +#undef LOG4CPLUS_HAVE_STAT + +/* */ +#undef LOG4CPLUS_HAVE_STDARG_H + +/* */ +#undef LOG4CPLUS_HAVE_STDIO_H + +/* */ +#undef LOG4CPLUS_HAVE_STDLIB_H + +/* */ +#undef LOG4CPLUS_HAVE_SYSLOG_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_FILE_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_SOCKET_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_STAT_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_SYSCALL_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_TIMEB_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_TIME_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_TYPES_H + +/* */ +#undef LOG4CPLUS_HAVE_TIME_H + +/* */ +#undef LOG4CPLUS_HAVE_TLS_SUPPORT + +/* */ +#undef LOG4CPLUS_HAVE_UNISTD_H + +/* */ +#undef LOG4CPLUS_HAVE_VFPRINTF_S + +/* */ +#undef LOG4CPLUS_HAVE_VFWPRINTF_S + +/* */ +#undef LOG4CPLUS_HAVE_VSNPRINTF + +/* */ +#undef LOG4CPLUS_HAVE_VSNWPRINTF + +/* */ +#undef LOG4CPLUS_HAVE_VSPRINTF_S + +/* */ +#undef LOG4CPLUS_HAVE_VSWPRINTF_S + +/* */ +#undef LOG4CPLUS_HAVE_WCHAR_H + +/* */ +#undef LOG4CPLUS_HAVE_WCSTOMBS + +/* */ +#undef LOG4CPLUS_HAVE__VSNPRINTF_S + +/* */ +#undef LOG4CPLUS_HAVE__VSNWPRINTF + +/* */ +#undef LOG4CPLUS_HAVE__VSNWPRINTF_S + +/* */ +#undef LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH + +/* */ +#undef LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH + +/* Define if this is a single-threaded library. */ +#undef LOG4CPLUS_SINGLE_THREADED + +/* */ +#undef LOG4CPLUS_THREAD_LOCAL_VAR + +/* */ +#undef LOG4CPLUS_USE_PTHREADS + +/* Define when iconv() is available. */ +#undef LOG4CPLUS_WITH_ICONV + +/* Define for C99 compilers/standard libraries that support more than just the + "C" locale. */ +#undef LOG4CPLUS_WORKING_C_LOCALE + +/* Define for compilers/standard libraries that support more than just the "C" + locale. */ +#undef LOG4CPLUS_WORKING_LOCALE + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Defined to the actual TLS support construct. */ +#undef TLS_SUPPORT_CONSTRUCT + +/* Substitute for socklen_t */ +#undef socklen_t + +#endif // LOG4CPLUS_CONFIG_H diff --git a/src/nar/resources/noarch/include/log4cplus/config.hxx b/src/nar/resources/noarch/include/log4cplus/config.hxx new file mode 100644 index 0000000..9e3c693 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config.hxx @@ -0,0 +1,166 @@ +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_CONFIG_HXX +#define LOG4CPLUS_CONFIG_HXX + +#if defined (_WIN32) +# include +#elif (defined(__MWERKS__) && defined(__MACOS__)) +# include +#else +# include +#endif + +#if ! defined (UNICODE) && ! defined (LOG4CPLUS_HAVE_VSNPRINTF_S) \ + && ! defined (LOG4CPLUS_HAVE__VSNPRINTF_S) \ + && ! defined (LOG4CPLUS_HAVE_VSNPRINTF) \ + && ! defined (LOG4CPLUS_HAVE__VSNPRINTF) +# undef LOG4CPLUS_USE_POOR_MANS_SNPRINTF +# define LOG4CPLUS_USE_POOR_MANS_SNPRINTF +#endif + +# if ! defined (LOG4CPLUS_WORKING_LOCALE) \ + && ! defined (LOG4CPLUS_WORKING_C_LOCALE) \ + && ! defined (LOG4CPLUS_WITH_ICONV) +# define LOG4CPLUS_POOR_MANS_CHCONV +#endif + +#ifndef LOG4CPLUS_DECLSPEC_EXPORT +#define LOG4CPLUS_DECLSPEC_EXPORT /* empty */ +#endif + +#ifndef LOG4CPLUS_DECLSPEC_IMPORT +#define LOG4CPLUS_DECLSPEC_IMPORT /* empty */ +#endif + +#ifndef LOG4CPLUS_DECLSPEC_PRIVATE +#define LOG4CPLUS_DECLSPEC_PRIVATE /* empty */ +#endif + +#define LOG4CPLUS_PRIVATE LOG4CPLUS_DECLSPEC_PRIVATE + +#if !defined(_WIN32) +# define LOG4CPLUS_USE_BSD_SOCKETS +# if !defined(LOG4CPLUS_SINGLE_THREADED) +# define LOG4CPLUS_USE_PTHREADS +# endif +# if defined (INSIDE_LOG4CPLUS) +# define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_EXPORT +# else +# define LOG4CPLUS_EXPORT LOG4CPLUS_DECLSPEC_IMPORT +# endif // defined (INSIDE_LOG4CPLUS) + +#endif // !_WIN32 + +#if defined (LOG4CPLUS_INLINES_ARE_EXPORTED) \ + && defined (LOG4CPLUS_BUILD_DLL) +# define LOG4CPLUS_INLINE_EXPORT inline +#else +# define LOG4CPLUS_INLINE_EXPORT +#endif + +#if defined (UNICODE) +# if defined (_MSC_VER) && _MSC_VER >= 1400 +# define LOG4CPLUS_FSTREAM_ACCEPTS_WCHAR_T +# endif +# if defined (_MSC_VER) && _MSC_VER >= 1600 +# define LOG4CPLUS_HAVE_CODECVT_UTF8_FACET +# define LOG4CPLUS_HAVE_CODECVT_UTF16_FACET +# endif +#endif + +// C++11 stuff + +#if ! defined (__has_feature) +//! __has_feature(X) is Clangs way for testing features. +//! Define it to 0 if it does not exist. +# define __has_feature(X) 0 +#endif + +#if (defined (_MSC_VER) && _MSC_VER >= 1600) \ + || defined (__GXX_EXPERIMENTAL_CXX0X__) \ + || __cplusplus >= 201103L +# define LOG4CPLUS_HAVE_CXX11_SUPPORT +#endif + +#if defined (LOG4CPLUS_HAVE_CXX11_SUPPORT) \ + || __has_feature (cxx_rvalue_references) +# define LOG4CPLUS_HAVE_RVALUE_REFS +#endif + +#if ! defined (UNICODE) && defined (__GNUC__) && __GNUC__ >= 3 +# define LOG4CPLUS_FORMAT_ATTRIBUTE(archetype, format_index, first_arg_index) \ + __attribute__ ((format (archetype, format_index, first_arg_index))) +#else +# define LOG4CPLUS_FORMAT_ATTRIBUTE(archetype, fmt_index, first_arg_index) \ + /* empty */ +#endif + +#if defined (__GNUC__) && __GNUC__ >= 3 +# define LOG4CPLUS_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# define LOG4CPLUS_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# define LOG4CPLUS_BUILTIN_EXPECT(exp, c) __builtin_expect ((exp), (c)) +#else +# if ! defined (LOG4CPLUS_ATTRIBUTE_NORETURN) +# define LOG4CPLUS_ATTRIBUTE_NORETURN /* empty */ +# endif +# define LOG4CPLUS_ATTRIBUTE_PURE /* empty */ +# define LOG4CPLUS_BUILTIN_EXPECT(exp, c) (exp) +#endif + +#define LOG4CPLUS_LIKELY(cond) LOG4CPLUS_BUILTIN_EXPECT(!! (cond), 1) +#define LOG4CPLUS_UNLIKELY(cond) LOG4CPLUS_BUILTIN_EXPECT(!! (cond), 0) + +#if defined (_MSC_VER) \ + || (defined (__BORLANDC__) && __BORLANDC__ >= 0x0650) \ + || (defined (__COMO__) && __COMO_VERSION__ >= 400) /* ??? */ \ + || (defined (__DMC__) && __DMC__ >= 0x700) /* ??? */ \ + || (defined (__clang__) && __clang_major__ >= 3) \ + || (defined (__GNUC__) && (__GNUC__ >= 4 \ + || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))) +# define LOG4CPLUS_HAVE_PRAGMA_ONCE +# pragma once +#endif + +#include + +#if defined(__cplusplus) +namespace log4cplus +{ + +//! Per thread cleanup function. Users should call this function before +//! a thread ends its execution. It frees resources allocated in thread local +//! storage. It is important only for multi-threaded static library builds +//! of log4cplus and user threads. In all other cases the clean up is provided +//! automatically by other means. +LOG4CPLUS_EXPORT void threadCleanup (); + +//! Initializes log4cplus. +LOG4CPLUS_EXPORT void initialize (); + +} // namespace log4cplus + +#endif + +#endif // LOG4CPLUS_CONFIG_HXX diff --git a/src/nar/resources/noarch/include/log4cplus/config/defines.hxx b/src/nar/resources/noarch/include/log4cplus/config/defines.hxx new file mode 100644 index 0000000..251b7a3 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config/defines.hxx @@ -0,0 +1,257 @@ +/* include/log4cplus/config/defines.hxx. Generated from defines.hxx.in by configure. */ +#ifndef LOG4CPLUS_CONFIG_DEFINES_HXX +#define LOG4CPLUS_CONFIG_DEFINES_HXX + +/* */ +#define LOG4CPLUS_HAVE_SYSLOG_H 1 + +/* */ +#define LOG4CPLUS_HAVE_ARPA_INET_H 1 + +/* */ +#define LOG4CPLUS_HAVE_NETINET_IN_H 1 + +/* */ +#define LOG4CPLUS_HAVE_NETINET_TCP_H 1 + +/* */ +#define LOG4CPLUS_HAVE_SYS_TIMEB_H 1 + +/* */ +#define LOG4CPLUS_HAVE_SYS_TIME_H 1 + +/* */ +#define LOG4CPLUS_HAVE_SYS_TYPES_H 1 + +/* */ +#define LOG4CPLUS_HAVE_SYS_STAT_H 1 + +/* */ +#define LOG4CPLUS_HAVE_SYS_SYSCALL_H 1 + +/* */ +#define LOG4CPLUS_HAVE_SYS_FILE_H 1 + +/* */ +#define LOG4CPLUS_HAVE_TIME_H 1 + +/* */ +#define LOG4CPLUS_HAVE_SYS_SOCKET_H 1 + +/* */ +#define LOG4CPLUS_HAVE_NETDB_H 1 + +/* */ +#define LOG4CPLUS_HAVE_UNISTD_H 1 + +/* */ +#define LOG4CPLUS_HAVE_FCNTL_H 1 + +/* */ +#define LOG4CPLUS_HAVE_STDARG_H 1 + +/* */ +#define LOG4CPLUS_HAVE_STDIO_H 1 + +/* */ +#define LOG4CPLUS_HAVE_STDLIB_H 1 + +/* */ +#define LOG4CPLUS_HAVE_ERRNO_H 1 + +/* */ +#define LOG4CPLUS_HAVE_WCHAR_H 1 + +/* */ +/* #undef LOG4CPLUS_HAVE_ICONV_H */ + +/* */ +#define LOG4CPLUS_HAVE_LIMITS_H 1 + +/* */ +#define LOG4CPLUS_HAVE_FTIME 1 + +/* */ +#define LOG4CPLUS_HAVE_GETADDRINFO 1 + +/* */ +#define LOG4CPLUS_HAVE_GETHOSTBYNAME_R 1 + +/* */ +#define LOG4CPLUS_HAVE_GETPID 1 + +/* */ +#define LOG4CPLUS_HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define LOG4CPLUS_HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the `nanosleep' function. */ +#define LOG4CPLUS_HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the `clock_nanosleep' function. */ +#define LOG4CPLUS_HAVE_CLOCK_NANOSLEEP 1 + +/* */ +#define LOG4CPLUS_HAVE_GMTIME_R 1 + +/* */ +#define LOG4CPLUS_HAVE_HTONL 1 + +/* */ +#define LOG4CPLUS_HAVE_HTONS 1 + +/* */ +#define LOG4CPLUS_HAVE_LOCALTIME_R 1 + +/* */ +#define LOG4CPLUS_HAVE_LSTAT 1 + +/* */ +#define LOG4CPLUS_HAVE_FCNTL 1 + +/* */ +#define LOG4CPLUS_HAVE_LOCKF 1 + +/* */ +#define LOG4CPLUS_HAVE_FLOCK 1 + +/* */ +#define LOG4CPLUS_HAVE_NTOHL 1 + +/* */ +#define LOG4CPLUS_HAVE_NTOHS 1 + +/* */ +#define LOG4CPLUS_HAVE_PIPE 1 + +/* */ +/* #undef LOG4CPLUS_HAVE_PIPE2 */ + +/* */ +#define LOG4CPLUS_HAVE_POLL 1 + +/* */ +#define LOG4CPLUS_HAVE_POLL_H 1 + +/* */ +#define LOG4CPLUS_HAVE_STAT 1 + +/* Define if this is a single-threaded library. */ +/* #undef LOG4CPLUS_SINGLE_THREADED */ + +/* */ +/* #undef LOG4CPLUS_USE_PTHREADS */ + +/* Define for compilers/standard libraries that support more than just the "C" + locale. */ +/* #undef LOG4CPLUS_WORKING_LOCALE */ + +/* Define for C99 compilers/standard libraries that support more than just the + "C" locale. */ +/* #undef LOG4CPLUS_WORKING_C_LOCALE */ + +/* Define to int if undefined. */ +/* #undef socklen_t */ + +/* Defined for --enable-debugging builds. */ +/* #undef LOG4CPLUS_DEBUGGING */ + +/* Defined if the compiler understands __declspec(dllexport) or + __attribute__((visibility("default"))) construct. */ +/* #undef LOG4CPLUS_DECLSPEC_EXPORT */ + +/* Defined if the compiler understands __declspec(dllimport) or + __attribute__((visibility("default"))) construct. */ +/* #undef LOG4CPLUS_DECLSPEC_IMPORT */ + +/* Defined if the compiler understands + __attribute__((visibility("hidden"))) construct. */ +/* #undef LOG4CPLUS_DECLSPEC_PRIVATE */ + +/* */ +#define LOG4CPLUS_HAVE_TLS_SUPPORT 1 + +/* */ +#define LOG4CPLUS_THREAD_LOCAL_VAR __thread + +/* Defined if the host OS provides ENAMETOOLONG errno value. */ +#define LOG4CPLUS_HAVE_ENAMETOOLONG 1 + +/* Defined if the compiler provides __sync_add_and_fetch(). */ +/* #undef LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH */ + +/* Defined if the compiler provides __sync_sub_and_fetch(). */ +/* #undef LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH */ + +/* Defined if the compiler provides C++11 header and increment, + decrement operations. */ +/* #undef LOG4CPLUS_HAVE_CXX11_ATOMICS */ + +/* */ +#define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS 1 + +/* */ +#define LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS 1 + +/* */ +#define LOG4CPLUS_HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the `vsnwprintf' function. */ +/* #undef LOG4CPLUS_HAVE_VSNWPRINTF */ + +/* Define to 1 if you have the `_vsnwprintf' function. */ +/* #undef LOG4CPLUS_HAVE__VSNWPRINTF */ + +/* */ +/* #undef LOG4CPLUS_HAVE__VSNPRINTF */ + +/* Define to 1 if you have the `vfprintf_s' function. */ +/* #undef LOG4CPLUS_HAVE_VFPRINTF_S */ + +/* Define to 1 if you have the `vfwprintf_s' function. */ +/* #undef LOG4CPLUS_HAVE_VFWPRINTF_S */ + +/* Define to 1 if you have the `vsprintf_s' function. */ +/* #undef LOG4CPLUS_HAVE_VSPRINTF_S */ + +/* Define to 1 if you have the `vswprintf_s' function. */ +/* #undef LOG4CPLUS_HAVE_VSWPRINTF_S */ + +/* Define to 1 if you have the `_vsnprintf_s' function. */ +/* #undef LOG4CPLUS_HAVE__VSNPRINTF_S */ + +/* Define to 1 if you have the `_vsnwprintf_s' function. */ +/* #undef LOG4CPLUS_HAVE__VSNWPRINTF_S */ + +/* Defined if the compiler supports __FUNCTION__ macro. */ +#define LOG4CPLUS_HAVE_FUNCTION_MACRO 1 + +/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */ +#define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO 1 + +/* Defined if the compiler supports __func__ symbol. */ +#define LOG4CPLUS_HAVE_FUNC_SYMBOL 1 + +/* Define to 1 if you have the `mbstowcs' function. */ +#define LOG4CPLUS_HAVE_MBSTOWCS 1 + +/* Define to 1 if you have the `wcstombs' function. */ +#define LOG4CPLUS_HAVE_WCSTOMBS 1 + +/* Define to 1 if you have Linux style syscall(SYS_gettid). */ +#define LOG4CPLUS_HAVE_GETTID 1 + +/* Define when iconv() is available. */ +/* #undef LOG4CPLUS_WITH_ICONV */ + +/* Define to 1 if you have the `iconv' function. */ +/* #undef LOG4CPLUS_HAVE_ICONV */ + +/* Define to 1 if you have the `iconv_close' function. */ +/* #undef LOG4CPLUS_HAVE_ICONV_CLOSE */ + +/* Define to 1 if you have the `iconv_open' function. */ +/* #undef LOG4CPLUS_HAVE_ICONV_OPEN */ + +#endif // LOG4CPLUS_CONFIG_DEFINES_HXX diff --git a/src/nar/resources/noarch/include/log4cplus/config/defines.hxx.cmake.in b/src/nar/resources/noarch/include/log4cplus/config/defines.hxx.cmake.in new file mode 100644 index 0000000..697ac33 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config/defines.hxx.cmake.in @@ -0,0 +1,236 @@ +#ifndef LOG4CPLUS_CONFIG_DEFINES_HXX +#define LOG4CPLUS_CONFIG_DEFINES_HXX + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYSLOG_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ARPA_INET_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETINET_IN_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETINET_TCP_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TIMEB_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TIME_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_TYPES_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_STAT_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_SYSCALL_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_FILE_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_TIME_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_SYS_SOCKET_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NETDB_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_UNISTD_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FCNTL_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDARG_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDIO_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STDLIB_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ERRNO_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_WCHAR_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LIMITS_H 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FTIME 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETADDRINFO 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETHOSTBYNAME_R 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETPID 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#cmakedefine LOG4CPLUS_HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the `nanosleep' function. */ +#cmakedefine LOG4CPLUS_HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the `clock_nanosleep' function. */ +#cmakedefine LOG4CPLUS_HAVE_CLOCK_NANOSLEEP 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GMTIME_R 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_HTONL 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_HTONS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LOCALTIME_R 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LSTAT 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FCNTL 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_LOCKF 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_FLOCK 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NTOHL 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_NTOHS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_STAT 1 + +/* Define if this is a single-threaded library. */ +#undef LOG4CPLUS_SINGLE_THREADED + +/* */ +#undef LOG4CPLUS_USE_PTHREADS + +/* Define for compilers/standard libraries that support more than just the "C" + locale. */ +#cmakedefine LOG4CPLUS_WORKING_LOCALE 1 + +/* Define for C99 compilers/standard libraries that support more than just the + "C" locale. */ +#cmakedefine LOG4CPLUS_WORKING_C_LOCALE 1 + +/* Define to int if undefined. */ +#cmakedefine socklen_t int + +/* Defined for --enable-debugging builds. */ +/* this is not used anywhere #undef LOG4CPLUS_DEBUGGING */ + +/* Defined if the compiler understands __declspec(export) or __attribute__((export)) construct. */ +#cmakedefine LOG4CPLUS_DECLSPEC_EXPORT @LOG4CPLUS_DECLSPEC_EXPORT@ + +/* Defined if the compiler understands __declspec(import) or __attribute__((import)) construct. */ +#cmakedefine LOG4CPLUS_DECLSPEC_IMPORT @LOG4CPLUS_DECLSPEC_IMPORT@ /**/ + +/* Defined if the compiler understands + __attribute__((visibility("hidden"))) construct. */ +#cmakedefine LOG4CPLUS_DECLSPEC_PRIVATE @LOG4CPLUS_DECLSPEC_PRIVATE@ + +/* */ +#cmakedefine LOG4CPLUS_HAVE_TLS_SUPPORT 1 + +/* */ +#cmakedefine LOG4CPLUS_THREAD_LOCAL_VAR @LOG4CPLUS_THREAD_LOCAL_VAR@ + +/* Defined if the host OS provides ENAMETOOLONG errno value. */ +#cmakedefine LOG4CPLUS_HAVE_ENAMETOOLONG 1 + +/* Defined if the compiler provides __sync_add_and_fetch(). */ +#cmakedefine LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH 1 + +/* Defined if the compiler provides __sync_sub_and_fetch(). */ +#cmakedefine LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH 1 + +/* Defined if the compiler provides C++11 header and increment, + decrement operations. */ +#cmakedefine LOG4CPLUS_HAVE_CXX11_ATOMICS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_C99_VARIADIC_MACROS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE_VSNPRINTF 1 + +/* */ +#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF 1 + +/* Define to 1 if you have the `vfprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VFPRINTF_S 1 + +/* Define to 1 if you have the `vfwprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VFWPRINTF_S 1 + +/* Define to 1 if you have the `vsprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VSPRINTF_S 1 + +/* Define to 1 if you have the `vswprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE_VSWPRINTF_S 1 + +/* Define to 1 if you have the `_vsnprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE__VSNPRINTF_S 1 + +/* Define to 1 if you have the `_vsnwprintf_s' function. */ +#cmakedefine LOG4CPLUS_HAVE__VSNWPRINTF_S 1 + +/* Defined if the compiler supports __FUNCTION__ macro. */ +#cmakedefine LOG4CPLUS_HAVE_FUNCTION_MACRO 1 + +/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */ +#cmakedefine LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO 1 + +/* Defined if the compiler supports __func__ symbol. */ +#cmakedefine LOG4CPLUS_HAVE_FUNC_SYMBOL 1 + +/* Define to 1 if you have the `mbstowcs' function. */ +#cmakedefine LOG4CPLUS_HAVE_MBSTOWCS 1 + +/* Define to 1 if you have the `wcstombs' function. */ +#cmakedefine LOG4CPLUS_HAVE_WCSTOMBS 1 + +/* Define to 1 if you have Linux style syscall(SYS_gettid). */ +#cmakedefine LOG4CPLUS_HAVE_GETTID 1 + +/* Define when iconv() is available. */ +#cmakedefine LOG4CPLUS_WITH_ICONV 1 + +/* Define to 1 if you have the `iconv' function. */ +#cmakedefine LOG4CPLUS_HAVE_ICONV 1 + +/* Define to 1 if you have the `iconv_close' function. */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_CLOSE 1 + +/* Define to 1 if you have the `iconv_open' function. */ +#cmakedefine LOG4CPLUS_HAVE_ICONV_OPEN 1 + +#endif // LOG4CPLUS_CONFIG_DEFINES_HXX diff --git a/src/nar/resources/noarch/include/log4cplus/config/defines.hxx.in b/src/nar/resources/noarch/include/log4cplus/config/defines.hxx.in new file mode 100644 index 0000000..286f983 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config/defines.hxx.in @@ -0,0 +1,256 @@ +#ifndef LOG4CPLUS_CONFIG_DEFINES_HXX +#define LOG4CPLUS_CONFIG_DEFINES_HXX + +/* */ +#undef LOG4CPLUS_HAVE_SYSLOG_H + +/* */ +#undef LOG4CPLUS_HAVE_ARPA_INET_H + +/* */ +#undef LOG4CPLUS_HAVE_NETINET_IN_H + +/* */ +#undef LOG4CPLUS_HAVE_NETINET_TCP_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_TIMEB_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_TIME_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_TYPES_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_STAT_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_SYSCALL_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_FILE_H + +/* */ +#undef LOG4CPLUS_HAVE_TIME_H + +/* */ +#undef LOG4CPLUS_HAVE_SYS_SOCKET_H + +/* */ +#undef LOG4CPLUS_HAVE_NETDB_H + +/* */ +#undef LOG4CPLUS_HAVE_UNISTD_H + +/* */ +#undef LOG4CPLUS_HAVE_FCNTL_H + +/* */ +#undef LOG4CPLUS_HAVE_STDARG_H + +/* */ +#undef LOG4CPLUS_HAVE_STDIO_H + +/* */ +#undef LOG4CPLUS_HAVE_STDLIB_H + +/* */ +#undef LOG4CPLUS_HAVE_ERRNO_H + +/* */ +#undef LOG4CPLUS_HAVE_WCHAR_H + +/* */ +#undef LOG4CPLUS_HAVE_ICONV_H + +/* */ +#undef LOG4CPLUS_HAVE_LIMITS_H + +/* */ +#undef LOG4CPLUS_HAVE_FTIME + +/* */ +#undef LOG4CPLUS_HAVE_GETADDRINFO + +/* */ +#undef LOG4CPLUS_HAVE_GETHOSTBYNAME_R + +/* */ +#undef LOG4CPLUS_HAVE_GETPID + +/* */ +#undef LOG4CPLUS_HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef LOG4CPLUS_HAVE_CLOCK_GETTIME + +/* Define to 1 if you have the `nanosleep' function. */ +#undef LOG4CPLUS_HAVE_NANOSLEEP + +/* Define to 1 if you have the `clock_nanosleep' function. */ +#undef LOG4CPLUS_HAVE_CLOCK_NANOSLEEP + +/* */ +#undef LOG4CPLUS_HAVE_GMTIME_R + +/* */ +#undef LOG4CPLUS_HAVE_HTONL + +/* */ +#undef LOG4CPLUS_HAVE_HTONS + +/* */ +#undef LOG4CPLUS_HAVE_LOCALTIME_R + +/* */ +#undef LOG4CPLUS_HAVE_LSTAT + +/* */ +#undef LOG4CPLUS_HAVE_FCNTL + +/* */ +#undef LOG4CPLUS_HAVE_LOCKF + +/* */ +#undef LOG4CPLUS_HAVE_FLOCK + +/* */ +#undef LOG4CPLUS_HAVE_NTOHL + +/* */ +#undef LOG4CPLUS_HAVE_NTOHS + +/* */ +#undef LOG4CPLUS_HAVE_PIPE + +/* */ +#undef LOG4CPLUS_HAVE_PIPE2 + +/* */ +#undef LOG4CPLUS_HAVE_POLL + +/* */ +#undef LOG4CPLUS_HAVE_POLL_H + +/* */ +#undef LOG4CPLUS_HAVE_STAT + +/* Define if this is a single-threaded library. */ +#undef LOG4CPLUS_SINGLE_THREADED + +/* */ +#undef LOG4CPLUS_USE_PTHREADS + +/* Define for compilers/standard libraries that support more than just the "C" + locale. */ +#undef LOG4CPLUS_WORKING_LOCALE + +/* Define for C99 compilers/standard libraries that support more than just the + "C" locale. */ +#undef LOG4CPLUS_WORKING_C_LOCALE + +/* Define to int if undefined. */ +#undef socklen_t + +/* Defined for --enable-debugging builds. */ +#undef LOG4CPLUS_DEBUGGING + +/* Defined if the compiler understands __declspec(dllexport) or + __attribute__((visibility("default"))) construct. */ +#undef LOG4CPLUS_DECLSPEC_EXPORT + +/* Defined if the compiler understands __declspec(dllimport) or + __attribute__((visibility("default"))) construct. */ +#undef LOG4CPLUS_DECLSPEC_IMPORT + +/* Defined if the compiler understands + __attribute__((visibility("hidden"))) construct. */ +#undef LOG4CPLUS_DECLSPEC_PRIVATE + +/* */ +#undef LOG4CPLUS_HAVE_TLS_SUPPORT + +/* */ +#undef LOG4CPLUS_THREAD_LOCAL_VAR + +/* Defined if the host OS provides ENAMETOOLONG errno value. */ +#undef LOG4CPLUS_HAVE_ENAMETOOLONG + +/* Defined if the compiler provides __sync_add_and_fetch(). */ +#undef LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH + +/* Defined if the compiler provides __sync_sub_and_fetch(). */ +#undef LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH + +/* Defined if the compiler provides C++11 header and increment, + decrement operations. */ +#undef LOG4CPLUS_HAVE_CXX11_ATOMICS + +/* */ +#undef LOG4CPLUS_HAVE_C99_VARIADIC_MACROS + +/* */ +#undef LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS + +/* */ +#undef LOG4CPLUS_HAVE_VSNPRINTF + +/* Define to 1 if you have the `vsnwprintf' function. */ +#undef LOG4CPLUS_HAVE_VSNWPRINTF + +/* Define to 1 if you have the `_vsnwprintf' function. */ +#undef LOG4CPLUS_HAVE__VSNWPRINTF + +/* */ +#undef LOG4CPLUS_HAVE__VSNPRINTF + +/* Define to 1 if you have the `vfprintf_s' function. */ +#undef LOG4CPLUS_HAVE_VFPRINTF_S + +/* Define to 1 if you have the `vfwprintf_s' function. */ +#undef LOG4CPLUS_HAVE_VFWPRINTF_S + +/* Define to 1 if you have the `vsprintf_s' function. */ +#undef LOG4CPLUS_HAVE_VSPRINTF_S + +/* Define to 1 if you have the `vswprintf_s' function. */ +#undef LOG4CPLUS_HAVE_VSWPRINTF_S + +/* Define to 1 if you have the `_vsnprintf_s' function. */ +#undef LOG4CPLUS_HAVE__VSNPRINTF_S + +/* Define to 1 if you have the `_vsnwprintf_s' function. */ +#undef LOG4CPLUS_HAVE__VSNWPRINTF_S + +/* Defined if the compiler supports __FUNCTION__ macro. */ +#undef LOG4CPLUS_HAVE_FUNCTION_MACRO + +/* Defined if the compiler supports __PRETTY_FUNCTION__ macro. */ +#undef LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO + +/* Defined if the compiler supports __func__ symbol. */ +#undef LOG4CPLUS_HAVE_FUNC_SYMBOL + +/* Define to 1 if you have the `mbstowcs' function. */ +#undef LOG4CPLUS_HAVE_MBSTOWCS + +/* Define to 1 if you have the `wcstombs' function. */ +#undef LOG4CPLUS_HAVE_WCSTOMBS + +/* Define to 1 if you have Linux style syscall(SYS_gettid). */ +#undef LOG4CPLUS_HAVE_GETTID + +/* Define when iconv() is available. */ +#undef LOG4CPLUS_WITH_ICONV + +/* Define to 1 if you have the `iconv' function. */ +#undef LOG4CPLUS_HAVE_ICONV + +/* Define to 1 if you have the `iconv_close' function. */ +#undef LOG4CPLUS_HAVE_ICONV_CLOSE + +/* Define to 1 if you have the `iconv_open' function. */ +#undef LOG4CPLUS_HAVE_ICONV_OPEN + +#endif // LOG4CPLUS_CONFIG_DEFINES_HXX diff --git a/src/nar/resources/noarch/include/log4cplus/config/macosx.h b/src/nar/resources/noarch/include/log4cplus/config/macosx.h new file mode 100644 index 0000000..448090c --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config/macosx.h @@ -0,0 +1,37 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: config-macosx.h +// Created: 7/2003 +// Author: Christopher R. Bailey +// +// +// Copyright 2003-2013 Christopher R. Bailey +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_CONFIG_MACOSX_HEADER_ +#define LOG4CPLUS_CONFIG_MACOSX_HEADER_ + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if (defined(__APPLE__) || (defined(__MWERKS__) && defined(__MACOS__))) + +#define LOG4CPLUS_HAVE_GETTIMEOFDAY 1 +#define socklen_t int + +#endif // MACOSX +#endif // LOG4CPLUS_CONFIG_MACOSX_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/config/win32.h b/src/nar/resources/noarch/include/log4cplus/config/win32.h new file mode 100644 index 0000000..c5b0d3d --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config/win32.h @@ -0,0 +1,202 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: config-win32.h +// Created: 4/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_CONFIG_WIN32_HEADER_ +#define LOG4CPLUS_CONFIG_WIN32_HEADER_ + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined (__MINGW32__) || defined (__MINGW64__) +# include <_mingw.h> +#endif + +#ifdef _WIN32 + +#if (defined (_MSC_VER) && _MSC_VER > 1400) \ + || (defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 3) +# define LOG4CPLUS_HAVE_INTRIN_H +#endif + +// Time related functions and headers. +#define LOG4CPLUS_HAVE_TIME_H +#define LOG4CPLUS_HAVE_SYS_TIMEB_H +#define LOG4CPLUS_HAVE_FTIME +#if defined (_MSC_VER) || defined (__BORLANDC__) +#define LOG4CPLUS_HAVE_GMTIME_S +#endif + +// Use Winsock on Windows. +#define LOG4CPLUS_USE_WINSOCK + +// Enable Win32DebugAppender +#define LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING + +// Enable Win32ConsoleAppender. +#define LOG4CPLUS_HAVE_WIN32_CONSOLE + +#define LOG4CPLUS_HAVE_SYS_TYPES_H +#define LOG4CPLUS_HAVE_SYS_LOCKING_H +#define LOG4CPLUS_HAVE_FCNTL_H +#define LOG4CPLUS_HAVE_IO_H +#define LOG4CPLUS_HAVE_STDIO_H +#define LOG4CPLUS_HAVE_WCHAR_H +#define LOG4CPLUS_HAVE_STDARG_H +#define LOG4CPLUS_HAVE_STDLIB_H +#define LOG4CPLUS_HAVE_ERRNO_H +#define LOG4CPLUS_HAVE_SYS_STAT_H +#define LOG4CPLUS_HAVE_TIME_H +#define LOG4CPLUS_HAVE_STDLIB_H + +// MSVC has both and so does MinGW. +#define LOG4CPLUS_HAVE_VSNPRINTF +#define LOG4CPLUS_HAVE__VSNPRINTF +#define LOG4CPLUS_HAVE__VSNWPRINTF + +#if defined (_MSC_VER) \ + || (defined (__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 3) +// MS secure versions of vprintf(). +# define LOG4CPLUS_HAVE_VSPRINTF_S +# define LOG4CPLUS_HAVE_VSWPRINTF_S + +// MS secure versions of vfprintf(). +# define LOG4CPLUS_HAVE_VFPRINTF_S +# define LOG4CPLUS_HAVE_VFWPRINTF_S + +// MS secure versions of vsnprintf(). +# define LOG4CPLUS_HAVE_VSNPRINTF_S +# define LOG4CPLUS_HAVE__VSNPRINTF_S +# define LOG4CPLUS_HAVE__VSNWPRINTF_S + +// MS printf-like functions supporting positional parameters. +# define LOG4CPLUS_HAVE__VSPRINTF_P +# define LOG4CPLUS_HAVE__VSWPRINTF_P + +// MS secure version of _tsopen(). +# define LOG4CPLUS_HAVE__TSOPEN_S +#endif + +#define LOG4CPLUS_HAVE__TSOPEN + +#define LOG4CPLUS_DLLMAIN_HINSTANCE HINSTANCE +#define LOG4CPLUS_HAVE_NT_EVENT_LOG + +// log4cplus_EXPORTS is used by the CMake build system. DLL_EXPORT is +// used by the autotools build system. +#if (defined (log4cplus_EXPORTS) || defined (log4cplusU_EXPORTS) \ + || defined (DLL_EXPORT)) \ + && ! defined (LOG4CPLUS_STATIC) +# undef LOG4CPLUS_BUILD_DLL +# define LOG4CPLUS_BUILD_DLL +#endif + +#if ! defined (LOG4CPLUS_BUILD_DLL) +# undef LOG4CPLUS_STATIC +# define LOG4CPLUS_STATIC +#endif + +#if defined (LOG4CPLUS_STATIC) && defined (LOG4CPLUS_BUILD_DLL) +# error LOG4CPLUS_STATIC and LOG4CPLUS_BUILD_DLL cannot be defined both. +#endif + +#if defined (LOG4CPLUS_BUILD_DLL) +# if defined (INSIDE_LOG4CPLUS) +# define LOG4CPLUS_EXPORT __declspec(dllexport) +# else +# define LOG4CPLUS_EXPORT __declspec(dllimport) +# endif +#else +# define LOG4CPLUS_EXPORT +#endif + +#ifndef LOG4CPLUS_SINGLE_THREADED +# define LOG4CPLUS_USE_WIN32_THREADS +#endif + +#if defined (_WIN32_WINNT) && _WIN32_WINNT < 0x0600 +# define LOG4CPLUS_POOR_MANS_SHAREDMUTEX +#endif + +#if defined(_MSC_VER) + // Warning about: identifier was truncated to '255' characters in the debug information +# pragma warning( disable : 4786 ) + // Warning about: needs to have dll-interface to be used by clients of class +# pragma warning( disable : 4251 ) + +# define LOG4CPLUS_INLINES_ARE_EXPORTED + +# if _MSC_VER >= 1400 +# define LOG4CPLUS_WORKING_LOCALE +# define LOG4CPLUS_HAVE_FUNCTION_MACRO +# define LOG4CPLUS_HAVE_FUNCSIG_MACRO +# define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS +# define LOG4CPLUS_ATTRIBUTE_NORETURN __declspec(noreturn) +# endif +# if _MSC_VER >= 1700 +# define LOG4CPLUS_HAVE_CXX11_ATOMICS +# endif +#endif + +#if defined (__GNUC__) +# undef LOG4CPLUS_INLINES_ARE_EXPORTED +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +# define LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO +# define LOG4CPLUS_HAVE_FUNC_SYMBOL +# endif +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) +# define LOG4CPLUS_HAVE___SYNC_SUB_AND_FETCH +# define LOG4CPLUS_HAVE___SYNC_ADD_AND_FETCH +# endif +# endif +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) +# if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) +# define LOG4CPLUS_HAVE___ATOMIC_ADD_FETCH +# define LOG4CPLUS_HAVE___ATOMIC_SUB_FETCH +# endif +# define LOG4CPLUS_INLINES_ARE_EXPORTED +# endif +# define LOG4CPLUS_HAVE_FUNCTION_MACRO +# define LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS +# define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS +# if defined (__MINGW32__) +# define LOG4CPLUS_WORKING_C_LOCALE +# endif +#endif + +#if defined (__BORLANDC__) && __BORLANDC__ >= 0x0650 +# define LOG4CPLUS_HAVE_FUNCTION_MACRO +# define LOG4CPLUS_HAVE_C99_VARIADIC_MACROS +#endif // __BORLANDC__ + +#if ! defined (LOG4CPLUS_DISABLE_DLL_RUNTIME_WARNING) +# if defined (LOG4CPLUS_STATIC) && defined (_MSC_VER) && ! defined (_DLL) +# pragma message("You are not using DLL C run time library. " \ + "You must call log4cplus::initialize() once before " \ + "you use any other log4cplus API.") +# endif +#endif + +#endif // _WIN32 +#endif // LOG4CPLUS_CONFIG_WIN32_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/config/windowsh-inc.h b/src/nar/resources/noarch/include/log4cplus/config/windowsh-inc.h new file mode 100644 index 0000000..b71a8e1 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/config/windowsh-inc.h @@ -0,0 +1,159 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: windowsh-inc.h +// Created: 4/2010 +// Author: Vaclav Zeman +// +// +// Copyright (C) 2010-2013, Vaclav Zeman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// NOTE: This file is a fragment intentionally left without include guards. + +#if defined (_WIN32) +#undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN + +#undef NOGDICAPMASKS +#define NOGDICAPMASKS + +#undef NOVIRTUALKEYCODES +#define NOVIRTUALKEYCODES + +#undef NOWINMESSAGES +#define NOWINMESSAGES + +#undef NOWINSTYLES +#define NOWINSTYLES + +#undef NOSYSMETRICS +#define NOSYSMETRICS + +#undef NOMENUS +#define NOMENUS + +#undef NOICONS +#define NOICONS + +#undef NOKEYSTATES +#define NOKEYSTATES + +#undef NOSYSCOMMANDS +#define NOSYSCOMMANDS + +#undef NORASTEROPS +#define NORASTEROPS + +#undef NOSHOWWINDOW +#define NOSHOWWINDOW + +#undef NOATOM +#define NOATOM + +#undef NOCLIPBOARD +#define NOCLIPBOARD + +#undef NOCOLOR +#define NOCOLOR + +#undef NOCTLMGR +#define NOCTLMGR + +#undef NODRAWTEXT +#define NODRAWTEXT + +#undef NOGDI +#define NOGDI + +#undef NOKERNEL +#define NOKERNEL + +#undef NOUSER +#define NOUSER + +#undef NONLS +#define NONLS + +#undef NOMB +#define NOMB + +#undef NOMEMMGR +#define NOMEMMGR + +#undef NOMETAFILE +#define NOMETAFILE + +#undef NOMINMAX +#define NOMINMAX + +#undef NOMSG +#define NOMSG + +#undef NOOPENFILE +#define NOOPENFILE + +#undef NOSCROLL +#define NOSCROLL + +#undef NOSERVICE +#define NOSERVICE + +#undef NOSOUND +#define NOSOUND + +#undef NOTEXTMETRIC +#define NOTEXTMETRIC + +#undef NOWH +#define NOWH + +#undef NOWINOFFSETS +#define NOWINOFFSETS + +#undef NOCOMM +#define NOCOMM + +#undef NOKANJI +#define NOKANJI + +#undef NOHELP +#define NOHELP + +#undef NOPROFILER +#define NOPROFILER + +#undef NODEFERWINDOWPOS +#define NODEFERWINDOWPOS + +#undef NOMCX +#define NOMCX + +#include +#include +#include +#if defined (LOG4CPLUS_HAVE_INTRIN_H) +#include +#endif +#endif + +// NOTE: This file is a fragment intentionally left without include guards. diff --git a/src/nar/resources/noarch/include/log4cplus/configurator.h b/src/nar/resources/noarch/include/log4cplus/configurator.h new file mode 100644 index 0000000..5cbb96f --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/configurator.h @@ -0,0 +1,374 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: configurator.h +// Created: 3/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_CONFIGURATOR_HEADER_ +#define LOG4CPLUS_CONFIGURATOR_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include + +#include + + +namespace log4cplus +{ + class Hierarchy; + + + /** + * Provides configuration from an external file. See configure() for + * the expected format. + * + * All option values admit variable substitution. For + * example, if userhome environment property is set to + * /home/xyz and the File option is set to the string + * ${userhome}/test.log, then File option will be + * interpreted as the string /home/xyz/test.log. + * + * The syntax of variable substitution is similar to that of UNIX + * shells. The string between an opening "${" and + * closing "}" is interpreted as a key. Its value is + * searched in the environment properties. The corresponding value replaces + * the ${variableName} sequence. + * + * Configuration files also recognize include + * file.properties directive that allow composing + * configuration from multiple files. There is no cyclic includes + * detection mechanism to stop unbound recursion. + */ + class LOG4CPLUS_EXPORT PropertyConfigurator + { + public: + enum PCFlags + { + fRecursiveExpansion = (1 << 0) + , fShadowEnvironment = (1 << 1) + , fAllowEmptyVars = (1 << 2) + + // These encoding related options occupy 2 bits of the flags + // and are mutually exclusive. These flags are synchronized with + // PFlags in Properties. + + , fEncodingShift = 3 + , fEncodingMask = 0x3 + , fUnspecEncoding = (0 << fEncodingShift) +#if defined (LOG4CPLUS_HAVE_CODECVT_UTF8_FACET) && defined (UNICODE) + , fUTF8 = (1 << fEncodingShift) +#endif +#if (defined (LOG4CPLUS_HAVE_CODECVT_UTF16_FACET) || defined (_WIN32)) \ + && defined (UNICODE) + , fUTF16 = (2 << fEncodingShift) +#endif +#if defined (LOG4CPLUS_HAVE_CODECVT_UTF32_FACET) && defined (UNICODE) + , fUTF32 = (3 << fEncodingShift) +#endif + }; + + // ctor and dtor + PropertyConfigurator(const log4cplus::tstring& propertyFile, + Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0); + PropertyConfigurator(const log4cplus::helpers::Properties& props, + Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0); + PropertyConfigurator(log4cplus::tistream& propertyStream, + Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0); + virtual ~PropertyConfigurator(); + + /** + * This method eliminates the need to create a temporary + * PropertyConfigurator to configure log4cplus. + * It is equivalent to the following:
+ * + * PropertyConfigurator config("filename"); + * config.configure(); + * + */ + static void doConfigure(const log4cplus::tstring& configFilename, + Hierarchy& h = Logger::getDefaultHierarchy(), unsigned flags = 0); + + /** + * Read configuration from a file. The existing configuration is + * not cleared nor reset. If you require a different behavior, + * then call {@link Hierarchy::resetConfiguration + * resetConfiguration} method before calling + * doConfigure. + * + * The configuration file consists of statements in the format + * key=value. The syntax of different configuration + * elements are discussed below. + * + *

Appender configuration

+ * + * Appender configuration syntax is: + *
+         * # For appender named appenderName, set its class.
+         * # Note: The appender name can contain dots.
+         * log4cplus.appender.appenderName=fully.qualified.name.of.appender.class
+         *
+         * # Set appender specific options.
+         * log4cplus.appender.appenderName.option1=value1
+         * ...
+         * log4cplus.appender.appenderName.optionN=valueN
+         * 
+ * + * For each named appender you can configure its {@link Layout}. The + * syntax for configuring an appender's layout is: + *
+         * log4cplus.appender.appenderName.layout=fully.qualified.name.of.layout.class
+         * log4cplus.appender.appenderName.layout.option1=value1
+         * ....
+         * log4cplus.appender.appenderName.layout.optionN=valueN
+         * 
+ * + *

Configuring loggers

+ * + * The syntax for configuring the root logger is: + *
+         * log4cplus.rootLogger=[LogLevel], appenderName, appenderName, ...
+         * 
+ * + * This syntax means that an optional LogLevel value can + * be supplied followed by appender names separated by commas. + * + * The LogLevel value can consist of the string values FATAL, + * ERROR, WARN, INFO, DEBUG or a custom LogLevel value. + * + * If a LogLevel value is specified, then the root LogLevel is set + * to the corresponding LogLevel. If no LogLevel value is specified, + * then the root LogLevel remains untouched. + * + * The root logger can be assigned multiple appenders. + * + * Each appenderName (separated by commas) will be added to + * the root logger. The named appender is defined using the + * appender syntax defined above. + * + * For non-root loggers the syntax is almost the same: + *
+         * log4cplus.logger.logger_name=[LogLevel|INHERITED], appenderName, appenderName, ...
+         * 
+ * + * The meaning of the optional LogLevel value is discussed above + * in relation to the root logger. In addition however, the value + * INHERITED can be specified meaning that the named logger should + * inherit its LogLevel from the logger hierarchy. + * + * By default loggers inherit their LogLevel from the + * hierarchy. However, if you set the LogLevel of a logger and + * later decide that that logger should inherit its LogLevel, then + * you should specify INHERITED as the value for the LogLevel value. + * + * Similar to the root logger syntax, each appenderName + * (separated by commas) will be attached to the named logger. + * + * See the appender + * additivity rule in the user manual for the meaning of the + * additivity flag. + * + * The user can override any of the {@link + * Hierarchy#disable} family of methods by setting the a key + * "log4cplus.disableOverride" to true or any value other + * than false. As in
log4cplus.disableOverride=true 
+ * + *

Example

+ * + * An example configuration is given below. + * + *
+         *
+         * # Set options for appender named "A1".
+         * # Appender "A1" will be a SyslogAppender
+         * log4cplus.appender.A1=log4cplus::SyslogAppender
+         *
+         * # The syslog daemon resides on www.abc.net
+         * log4cplus.appender.A1.SyslogHost=www.abc.net
+         *
+         * # A1's layout is a PatternLayout, using the conversion pattern
+         * # %r %-5p %c{2} %M.%L %x - %m\n. Thus, the log output will
+         * # include # the relative time since the start of the application in
+         * # milliseconds, followed by the LogLevel of the log request,
+         * # followed by the two rightmost components of the logger name,
+         * # followed by the callers method name, followed by the line number,
+         * # the nested disgnostic context and finally the message itself.
+         * # Refer to the documentation of {@link PatternLayout} for further information
+         * # on the syntax of the ConversionPattern key.
+         * log4cplus.appender.A1.layout=log4cplus::PatternLayout
+         * log4cplus.appender.A1.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n
+         *
+         * # Set options for appender named "A2"
+         * # A2 should be a RollingFileAppender, with maximum file size of 10 MB
+         * # using at most one backup file. A2's layout is TTCC, using the
+         * # ISO8061 date format with context printing enabled.
+         * log4cplus.appender.A2=log4cplus::RollingFileAppender
+         * log4cplus.appender.A2.MaxFileSize=10MB
+         * log4cplus.appender.A2.MaxBackupIndex=1
+         * log4cplus.appender.A2.layout=log4cplus::TTCCLayout
+         * log4cplus.appender.A2.layout.ContextPrinting=enabled
+         * log4cplus.appender.A2.layout.DateFormat=ISO8601
+         *
+         * # Root logger set to DEBUG using the A2 appender defined above.
+         * log4cplus.rootLogger=DEBUG, A2
+         *
+         * # Logger definitions:
+         * # The SECURITY logger inherits is LogLevel from root. However, it's output
+         * # will go to A1 appender defined above. It's additivity is non-cumulative.
+         * log4cplus.logger.SECURITY=INHERIT, A1
+         * log4cplus.additivity.SECURITY=false
+         *
+         * # Only warnings or above will be logged for the logger "SECURITY.access".
+         * # Output will go to A1.
+         * log4cplus.logger.SECURITY.access=WARN
+         *
+         *
+         * # The logger "class.of.the.day" inherits its LogLevel from the
+         * # logger hierarchy.  Output will go to the appender's of the root
+         * # logger, A2 in this case.
+         * log4cplus.logger.class.of.the.day=INHERIT
+         * 
+ * + * Refer to the setOption method in each Appender and + * Layout for class specific options. + * + * Use the # character at the beginning of a line + * for comments. + */ + virtual void configure(); + + /** + * \return The return value is reference to Properties + * container of properties with the "log4cplus." + * prefix removed and references to other properties and/or + * environment variables expanded. + */ + log4cplus::helpers::Properties const & getProperties () const; + + /** + * \return The return value is a reference to log4cplus::tstring + * containing filename of properties source file. It will be + * string "UNAVAILABLE" if the PropertyConfigurator instance has been + * constructed using one of the other constructors that do not take + * filename as parameter. + */ + log4cplus::tstring const & getPropertyFilename () const; + + protected: + // Methods + void init(); // called by the ctor + void reconfigure(); + void replaceEnvironVariables(); + void configureLoggers(); + void configureLogger(log4cplus::Logger logger, const log4cplus::tstring& config); + void configureAppenders(); + void configureAdditivity(); + + virtual Logger getLogger(const log4cplus::tstring& name); + virtual void addAppender(Logger &logger, log4cplus::SharedAppenderPtr& appender); + + // Types + typedef std::map AppenderMap; + + // Data + Hierarchy& h; + log4cplus::tstring propertyFilename; + log4cplus::helpers::Properties properties; + AppenderMap appenders; + unsigned flags; + + private: + // Disable copy + PropertyConfigurator(const PropertyConfigurator&); + PropertyConfigurator& operator=(PropertyConfigurator&); + }; + + + + /** + * Use this class to quickly configure the package. For file based + * configuration see PropertyConfigurator. BasicConfigurator + * automatically attaches ConsoleAppender to + * rootLogger, with output going to standard output, + * using DEBUG LogLevel value. The additional parameter + * logToStdErr may redirect the output to standard error. + */ + class LOG4CPLUS_EXPORT BasicConfigurator : public PropertyConfigurator { + public: + // ctor and dtor + BasicConfigurator(Hierarchy& h = Logger::getDefaultHierarchy(), + bool logToStdErr = false); + virtual ~BasicConfigurator(); + + /** + * This method eliminates the need to create a temporary + * BasicConfigurator object to configure log4cplus. + * It is equivalent to the following:
+ *
+         * BasicConfigurator config;
+         * config.configure();
+         * 
+ */ + static void doConfigure(Hierarchy& h = Logger::getDefaultHierarchy(), + bool logToStdErr = false); + + //! Property name for disable override. + static log4cplus::tstring const DISABLE_OVERRIDE_KEY; + + private: + // Disable copy + BasicConfigurator(const BasicConfigurator&); + BasicConfigurator& operator=(BasicConfigurator&); + }; + + +#if !defined(LOG4CPLUS_SINGLE_THREADED) + // Forward Declarations + class ConfigurationWatchDogThread; + + + class LOG4CPLUS_EXPORT ConfigureAndWatchThread { + public: + // ctor and dtor + ConfigureAndWatchThread(const log4cplus::tstring& propertyFile, + unsigned int millis = 60 * 1000); + virtual ~ConfigureAndWatchThread(); + + private: + // Disallow copying of instances of this class + ConfigureAndWatchThread(const ConfigureAndWatchThread&); + ConfigureAndWatchThread& operator=(const ConfigureAndWatchThread&); + + // Data + ConfigurationWatchDogThread * watchDogThread; + }; +#endif + +} // end namespace log4cplus + +#endif // LOG4CPLUS_CONFIGURATOR_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/consoleappender.h b/src/nar/resources/noarch/include/log4cplus/consoleappender.h new file mode 100644 index 0000000..e31bdad --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/consoleappender.h @@ -0,0 +1,85 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: consoleappender.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_CONSOLE_APPENDER_HEADER_ +#define LOG4CPLUS_CONSOLE_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +namespace log4cplus { + /** + * ConsoleAppender appends log events to std::cout or + * std::cerr using a layout specified by the + * user. The default target is std::cout. + * + *

Properties

+ *
+ *
logToStdErr
+ *
When it is set true, the output stream will be + * std::cerr instead of std::cout.
+ * + *
ImmediateFlush
+ *
When it is set true, output stream will be flushed after + * each appended event.
+ * + *
+ * \sa Appender + */ + class LOG4CPLUS_EXPORT ConsoleAppender : public Appender { + public: + // Ctors + ConsoleAppender(bool logToStdErr = false, bool immediateFlush = false); + ConsoleAppender(const log4cplus::helpers::Properties & properties); + + // Dtor + ~ConsoleAppender(); + + // Methods + virtual void close(); + + //! This mutex is used by ConsoleAppender and helpers::LogLog + //! classes to synchronize output to console. + static log4cplus::thread::Mutex const & getOutputMutex(); + + protected: + virtual void append(const spi::InternalLoggingEvent& event); + + // Data + bool logToStdErr; + /** + * Immediate flush means that the underlying output stream + * will be flushed at the end of each append operation. + */ + bool immediateFlush; + }; + +} // end namespace log4cplus + +#endif // LOG4CPLUS_CONSOLE_APPENDER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/fileappender.h b/src/nar/resources/noarch/include/log4cplus/fileappender.h new file mode 100644 index 0000000..787b92e --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/fileappender.h @@ -0,0 +1,282 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: fileappender.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_FILE_APPENDER_HEADER_ +#define LOG4CPLUS_FILE_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + + +namespace log4cplus +{ + + /** + * Appends log events to a file. + * + *

Properties

+ *
+ *
File
+ *
This property specifies output file name.
+ * + *
ImmediateFlush
+ *
When it is set true, output stream will be flushed after + * each appended event.
+ * + *
Append
+ *
When it is set true, output file will be appended to + * instead of being truncated at opening.
+ * + *
ReopenDelay
+ *
This property sets a delay after which the appender will try + * to reopen log file again, after last logging failure. + *
+ * + *
BufferSize
+ *
Non-zero value of this property sets up buffering of output + * stream using a buffer of given size. + *
+ * + *
UseLockFile
+ *
Set this property to true if you want your output + * to go into a log file shared by multiple processes. When this + * property is set to true then log4cplus uses OS specific + * facilities (e.g., lockf()) to provide + * inter-process file locking. + * \sa Appender + *
+ * + *
LockFile
+ *
This property specifies lock file, file used for + * inter-process synchronization of log file access. When this + * property is not specified, the value is derived from + * File property by addition of ".lock" suffix. The + * property is only used when UseLockFile is set to true. + * \sa Appender + *
+ * + *
Locale
+ *
This property specifies a locale name that will be imbued + * into output stream. Locale can be specified either by system + * specific locale name, e.g., en_US.UTF-8, or by one of + * four recognized keywords: GLOBAL, DEFAULT + * (which is an alias for GLOBAL), USER and + * CLASSIC. When specified locale is not available, + * GLOBAL is used instead. It is possible to register + * additional locale keywords by registering an instance of + * spi::LocaleFactory in + * spi::LocaleFactoryRegistry. + * \sa spi::getLocaleFactoryRegistry() + *
+ * + *
+ */ + class LOG4CPLUS_EXPORT FileAppender : public Appender { + public: + // Ctors + FileAppender(const log4cplus::tstring& filename, + std::ios_base::openmode mode = std::ios_base::trunc, + bool immediateFlush = true); + FileAppender(const log4cplus::helpers::Properties& properties, + std::ios_base::openmode mode = std::ios_base::trunc); + + // Dtor + virtual ~FileAppender(); + + // Methods + virtual void close(); + + //! Redefine default locale for output stream. It may be a good idea to + //! provide UTF-8 locale in case UNICODE macro is defined. + virtual std::locale imbue(std::locale const& loc); + + //! \returns Locale imbued in fstream. + virtual std::locale getloc () const; + + protected: + virtual void append(const spi::InternalLoggingEvent& event); + + void open(std::ios_base::openmode mode); + bool reopen(); + + // Data + /** + * Immediate flush means that the underlying writer or output stream + * will be flushed at the end of each append operation. Immediate + * flush is slower but ensures that each append request is actually + * written. If immediateFlush is set to + * false, then there is a good chance that the last few + * logs events are not actually written to persistent media if and + * when the application crashes. + * + * The immediateFlush variable is set to + * true by default. + */ + bool immediateFlush; + + /** + * When any append operation fails, reopenDelay says + * for how many seconds the next attempt to re-open the log file and + * resume logging will be delayed. If reopenDelay is zero, + * each failed append operation will cause log file to be re-opened. + * By default, reopenDelay is 1 second. + */ + int reopenDelay; + + unsigned long bufferSize; + log4cplus::tchar * buffer; + + log4cplus::tofstream out; + log4cplus::tstring filename; + log4cplus::tstring localeName; + + log4cplus::helpers::Time reopen_time; + + private: + LOG4CPLUS_PRIVATE void init(const log4cplus::tstring& filename, + std::ios_base::openmode mode, + const log4cplus::tstring& lockFileName); + + // Disallow copying of instances of this class + FileAppender(const FileAppender&); + FileAppender& operator=(const FileAppender&); + }; + + + + /** + * RollingFileAppender extends FileAppender to backup the log + * files when they reach a certain size. + * + *

Properties

+ *

Properties additional to {@link FileAppender}'s properties: + * + *

+ *
MaxFileSize
+ *
This property specifies maximal size of output file. The + * value is in bytes. It is possible to use MB and + * KB suffixes to specify the value in megabytes or + * kilobytes instead.
+ * + *
MaxBackupIndex
+ *
This property limits the number of backup output + * files; e.g. how many log.1, log.2 etc. files + * will be kept.
+ *
+ */ + class LOG4CPLUS_EXPORT RollingFileAppender : public FileAppender { + public: + // Ctors + RollingFileAppender(const log4cplus::tstring& filename, + long maxFileSize = 10*1024*1024, // 10 MB + int maxBackupIndex = 1, + bool immediateFlush = true); + RollingFileAppender(const log4cplus::helpers::Properties& properties); + + // Dtor + virtual ~RollingFileAppender(); + + protected: + virtual void append(const spi::InternalLoggingEvent& event); + void rollover(bool alreadyLocked = false); + + // Data + long maxFileSize; + int maxBackupIndex; + + private: + LOG4CPLUS_PRIVATE void init(long maxFileSize, int maxBackupIndex); + }; + + + + enum DailyRollingFileSchedule { MONTHLY, WEEKLY, DAILY, + TWICE_DAILY, HOURLY, MINUTELY}; + + /** + * DailyRollingFileAppender extends {@link FileAppender} so that the + * underlying file is rolled over at a user chosen frequency. + * + *

Properties

+ *

Properties additional to {@link FileAppender}'s properties: + * + *

+ *
Schedule
+ *
This property specifies rollover schedule. The possible + * values are MONTHLY, WEEKLY, DAILY, + * TWICE_DAILY, HOURLY and + * MINUTELY.
+ * + *
MaxBackupIndex
+ *
This property limits how many backup files are kept per + * single logging period; e.g. how many log.2009-11-07.1, + * log.2009-11-07.2 etc. files are kept.
+ * + *
+ */ + class LOG4CPLUS_EXPORT DailyRollingFileAppender : public FileAppender { + public: + // Ctors + DailyRollingFileAppender(const log4cplus::tstring& filename, + DailyRollingFileSchedule schedule = DAILY, + bool immediateFlush = true, + int maxBackupIndex = 10); + DailyRollingFileAppender(const log4cplus::helpers::Properties& properties); + + // Dtor + virtual ~DailyRollingFileAppender(); + + // Methods + virtual void close(); + + protected: + virtual void append(const spi::InternalLoggingEvent& event); + void rollover(bool alreadyLocked = false); + log4cplus::helpers::Time calculateNextRolloverTime(const log4cplus::helpers::Time& t) const; + log4cplus::tstring getFilename(const log4cplus::helpers::Time& t) const; + + // Data + DailyRollingFileSchedule schedule; + log4cplus::tstring scheduledFilename; + log4cplus::helpers::Time nextRolloverTime; + int maxBackupIndex; + + private: + LOG4CPLUS_PRIVATE void init(DailyRollingFileSchedule schedule); + }; + +} // end namespace log4cplus + +#endif // LOG4CPLUS_FILE_APPENDER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/fstreams.h b/src/nar/resources/noarch/include/log4cplus/fstreams.h new file mode 100644 index 0000000..d0c0831 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/fstreams.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: fstreams.h +// Created: 4/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_FSTREAMS_HEADER_ +#define LOG4CPLUS_FSTREAMS_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + + +namespace log4cplus +{ + + +typedef std::basic_ofstream tofstream; +typedef std::basic_ifstream tifstream; + +//! \def LOG4CPLUS_FSTREAM_PREFERED_FILE_NAME(X) +//! \brief Expands into expression that picks the right type for +//! std::fstream file name parameter. +#if defined (LOG4CPLUS_FSTREAM_ACCEPTS_WCHAR_T) && defined (UNICODE) +# define LOG4CPLUS_FSTREAM_PREFERED_FILE_NAME(X) (X) +#else +# define LOG4CPLUS_FSTREAM_PREFERED_FILE_NAME(X) (LOG4CPLUS_TSTRING_TO_STRING(X)) +#endif + + +} + +#endif // LOG4CPLUS_FSTREAMS_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/appenderattachableimpl.h b/src/nar/resources/noarch/include/log4cplus/helpers/appenderattachableimpl.h new file mode 100644 index 0000000..4cfaf3f --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/appenderattachableimpl.h @@ -0,0 +1,119 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: appenderattachableimpl.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_ +#define LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include + +#include +#include + + +namespace log4cplus { + namespace helpers { + + /** + * This Interface is for attaching Appenders to objects. + */ + class LOG4CPLUS_EXPORT AppenderAttachableImpl + : public log4cplus::spi::AppenderAttachable + { + public: + // Data + thread::Mutex appender_list_mutex; + + // Ctors + AppenderAttachableImpl(); + + // Dtor + virtual ~AppenderAttachableImpl(); + + // Methods + /** + * Add an appender. If the appender is already in the list in + * won't be added again. + */ + virtual void addAppender(SharedAppenderPtr newAppender); + + /** + * Get all previously added appenders as an vectory. + */ + virtual SharedAppenderPtrList getAllAppenders(); + + /** + * Look for an attached appender named as name. + * + * Return the appender with that name if in the list. Return null + * otherwise. + */ + virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name); + + /** + * Remove all previously added appenders. + */ + virtual void removeAllAppenders(); + + /** + * Remove the appender passed as parameter from the list of appenders. + */ + virtual void removeAppender(SharedAppenderPtr appender); + + /** + * Remove the appender with the name passed as parameter from the + * list of appenders. + */ + virtual void removeAppender(const log4cplus::tstring& name); + + /** + * Call the doAppend method on all attached appenders. + */ + int appendLoopOnAppenders(const spi::InternalLoggingEvent& event) const; + + protected: + // Types + typedef std::vector ListType; + + // Data + /** Array of appenders. */ + ListType appenderList; + + private: + AppenderAttachableImpl(AppenderAttachableImpl const &); + AppenderAttachableImpl & operator = (AppenderAttachableImpl const &); + }; // end class AppenderAttachableImpl + + } // end namespace helpers +} // end namespace log4cplus + +#endif // LOG4CPLUS_HELPERS_APPENDER_ATTACHABLE_IMPL_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/fileinfo.h b/src/nar/resources/noarch/include/log4cplus/helpers/fileinfo.h new file mode 100644 index 0000000..725c940 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/fileinfo.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +// +// Copyright (C) 2012-2013, Vaclav Zeman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ! defined (LOG4CPLUS_HELPERS_FILEINFO_H) +#define LOG4CPLUS_HELPERS_FILEINFO_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#ifdef LOG4CPLUS_HAVE_SYS_TYPES_H +#include +#endif + + +namespace log4cplus { namespace helpers { + +//! FileInfo structure is OS independent abstraction of the +//! stat() function. +struct LOG4CPLUS_EXPORT FileInfo +{ + helpers::Time mtime; + bool is_link; + off_t size; +}; + + +//! OS independent abstraction of stat() function. +LOG4CPLUS_EXPORT int getFileInfo (FileInfo * fi, tstring const & name); + + +} } // namespace log4cplus { namespace helpers { + +#endif // LOG4CPLUS_HELPERS_FILEINFO_H diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/lockfile.h b/src/nar/resources/noarch/include/log4cplus/helpers/lockfile.h new file mode 100644 index 0000000..f451ff8 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/lockfile.h @@ -0,0 +1,68 @@ +// -*- C++ -*- +// +// Copyright (C) 2012-2013, Vaclav Zeman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ! defined (LOG4CPLUS_HELPERS_LOCKFILE_H) +#define LOG4CPLUS_HELPERS_LOCKFILE_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + + +namespace log4cplus { namespace helpers { + + +class LOG4CPLUS_EXPORT LockFile +{ +public: + LockFile (tstring const & lock_file); + ~LockFile (); + + void lock () const; + void unlock () const; + +private: + void open (int) const; + void close () const; + + struct Impl; + + tstring lock_file_name; + Impl * data; +}; + + +typedef log4cplus::thread::SyncGuard LockFileGuard; + + +} } // namespace log4cplus { namespace helpers { + + +#endif // LOG4CPLUS_HELPERS_LOCKFILE_H diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/loglog.h b/src/nar/resources/noarch/include/log4cplus/helpers/loglog.h new file mode 100644 index 0000000..336f18f --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/loglog.h @@ -0,0 +1,145 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: loglog.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_LOGLOG +#define LOG4CPLUS_HELPERS_LOGLOG + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include + + +namespace log4cplus { + namespace helpers { + + /** + * This class used to output log statements from within the log4cplus package. + * + * Log4cplus components cannot make log4cplus logging calls. However, it is + * sometimes useful for the user to learn about what log4cplus is + * doing. You can enable log4cplus internal logging by defining the + * log4cplus.configDebug variable. + * + * All log4cplus internal debug calls go to cout + * where as internal error messages are sent to + * cerr. All internal messages are prepended with + * the string "log4clus: ". + */ + class LOG4CPLUS_EXPORT LogLog + { + public: + //! Return type of getLogLog(). + typedef LogLog * Ptr; + + /** + * Returns a reference to the LogLog singleton. + */ + static Ptr getLogLog(); + + + /** + * Allows to enable/disable log4cplus internal logging. + */ + void setInternalDebugging(bool enabled); + + /** + * In quite mode no LogLog generates strictly no output, not even + * for errors. + * + * @param quietMode A true for not + */ + void setQuietMode(bool quietMode); + + /** + * This method is used to output log4cplus internal debug + * statements. Output goes to std::cout. + */ + void debug(const log4cplus::tstring& msg) const; + void debug(tchar const * msg) const; + + /** + * This method is used to output log4cplus internal error + * statements. There is no way to disable error + * statements. Output goes to + * std::cerr. Optionally, this method can + * throw std::runtime_error exception too. + */ + void error(const log4cplus::tstring& msg, bool throw_flag = false) const; + void error(tchar const * msg, bool throw_flag = false) const; + + /** + * This method is used to output log4cplus internal warning + * statements. There is no way to disable warning statements. + * Output goes to std::cerr. + */ + void warn(const log4cplus::tstring& msg) const; + void warn(tchar const * msg) const; + + // Public ctor and dtor to be used only by internal::DefaultContext. + LogLog(); + virtual ~LogLog(); + + private: + enum TriState + { + TriUndef = -1, + TriFalse, + TriTrue + }; + + template + LOG4CPLUS_PRIVATE + void logging_worker (tostream & os, + bool (LogLog:: * cond) () const, tchar const *, + StringType const &, bool throw_flag = false) const; + + LOG4CPLUS_PRIVATE static void set_tristate_from_env (TriState *, + tchar const * envvar); + + LOG4CPLUS_PRIVATE bool get_quiet_mode () const; + LOG4CPLUS_PRIVATE bool get_not_quiet_mode () const; + LOG4CPLUS_PRIVATE bool get_debug_mode () const; + + // Data + mutable TriState debugEnabled; + mutable TriState quietMode; + thread::Mutex mutex; + + LOG4CPLUS_PRIVATE LogLog(const LogLog&); + LOG4CPLUS_PRIVATE LogLog & operator = (LogLog const &); + }; + + LOG4CPLUS_EXPORT LogLog & getLogLog (); + + } // end namespace helpers +} // end namespace log4cplus + + +#endif // LOG4CPLUS_HELPERS_LOGLOG + diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/logloguser.h b/src/nar/resources/noarch/include/log4cplus/helpers/logloguser.h new file mode 100644 index 0000000..11b3f5e --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/logloguser.h @@ -0,0 +1,64 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: logloguser.h +// Created: 6/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_LOGLOG_USER +#define LOG4CPLUS_HELPERS_LOGLOG_USER + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + + +namespace log4cplus { + namespace helpers { + // forward declarations + class LogLog; + + /** + * This class used to simplify the use of the LogLog class. Any class + * that uses the LogLog class should extend this class and retrieve + * their reference to LogLog using the method provided. + */ + class LOG4CPLUS_EXPORT LogLogUser + { + public: + // ctor and dtor + LogLogUser(); + LogLogUser(const LogLogUser&); + virtual ~LogLogUser(); + + // public methods + LogLog& getLogLog() const; + + // operators + LogLogUser& operator=(const LogLogUser& rhs); + }; + + } // end namespace helpers +} // end namespace log4cplus + + +#endif // LOG4CPLUS_HELPERS_LOGLOG_USER + diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/pointer.h b/src/nar/resources/noarch/include/log4cplus/helpers/pointer.h new file mode 100644 index 0000000..0b1b6fe --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/pointer.h @@ -0,0 +1,191 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: pointer.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +// Note: Some of this code uses ideas from "More Effective C++" by Scott +// Myers, Addison Wesley Longmain, Inc., (c) 1996, Chapter 29, pp. 183-213 +// + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_POINTERS_HEADER_ +#define LOG4CPLUS_HELPERS_POINTERS_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#if ! defined (LOG4CPLUS_SINGLE_THREADED) \ + && defined (LOG4CPLUS_HAVE_CXX11_ATOMICS) +#include +#endif + + +namespace log4cplus { + namespace helpers { + + /****************************************************************************** + * Class SharedObject (from pp. 204-205) * + ******************************************************************************/ + + class LOG4CPLUS_EXPORT SharedObject + { + public: + void addReference() const; + void removeReference() const; + + protected: + // Ctor + SharedObject() + : access_mutex() + , count(0) + { } + + SharedObject(const SharedObject&) + : access_mutex() + , count(0) + { } + + // Dtor + virtual ~SharedObject(); + + // Operators + SharedObject& operator=(const SharedObject&) { return *this; } + + public: + thread::Mutex access_mutex; + + private: +#if defined (LOG4CPLUS_SINGLE_THREADED) + typedef unsigned count_type; +#elif defined (LOG4CPLUS_HAVE_CXX11_ATOMICS) + typedef std::atomic count_type; +#elif defined (_WIN32) || defined (__CYGWIN__) + typedef long count_type; +#else + typedef unsigned count_type; +#endif + mutable count_type count; + }; + + + /****************************************************************************** + * Template Class SharedObjectPtr (from pp. 203, 206) * + ******************************************************************************/ + template + class SharedObjectPtr + { + public: + // Ctor + explicit + SharedObjectPtr(T* realPtr = 0) + : pointee(realPtr) + { + addref (); + } + + SharedObjectPtr(const SharedObjectPtr& rhs) + : pointee(rhs.pointee) + { + addref (); + } + +#if defined (LOG4CPLUS_HAVE_RVALUE_REFS) + SharedObjectPtr(SharedObjectPtr && rhs) + : pointee (std::move (rhs.pointee)) + { + rhs.pointee = 0; + } + + SharedObjectPtr & operator = (SharedObjectPtr && rhs) + { + rhs.swap (*this); + return *this; + } +#endif + + // Dtor + ~SharedObjectPtr() + { + if (pointee) + pointee->removeReference(); + } + + // Operators + bool operator==(const SharedObjectPtr& rhs) const { return (pointee == rhs.pointee); } + bool operator!=(const SharedObjectPtr& rhs) const { return (pointee != rhs.pointee); } + bool operator==(const T* rhs) const { return (pointee == rhs); } + bool operator!=(const T* rhs) const { return (pointee != rhs); } + T* operator->() const {assert (pointee); return pointee; } + T& operator*() const {assert (pointee); return *pointee; } + + SharedObjectPtr& operator=(const SharedObjectPtr& rhs) + { + return this->operator = (rhs.pointee); + } + + SharedObjectPtr& operator=(T* rhs) + { + SharedObjectPtr (rhs).swap (*this); + return *this; + } + + // Methods + T* get() const { return pointee; } + + void swap (SharedObjectPtr & other) throw () + { + std::swap (pointee, other.pointee); + } + + typedef T * (SharedObjectPtr:: * unspec_bool_type) () const; + operator unspec_bool_type () const + { + return pointee ? &SharedObjectPtr::get : 0; + } + + bool operator ! () const + { + return ! pointee; + } + + private: + // Methods + void addref() const + { + if (pointee) + pointee->addReference(); + } + + // Data + T* pointee; + }; + + } // end namespace helpers +} // end namespace log4cplus + + +#endif // LOG4CPLUS_HELPERS_POINTERS_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/property.h b/src/nar/resources/noarch/include/log4cplus/helpers/property.h new file mode 100644 index 0000000..e97c6d4 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/property.h @@ -0,0 +1,162 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: property.h +// Created: 2/2002 +// Author: Tad E. Smith +// +// +// Copyright 2002-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_PROPERTY_HEADER_ +#define LOG4CPLUS_HELPERS_PROPERTY_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include + + +namespace log4cplus { + namespace helpers { + + //! \sa log4cplus::PropertyConfigurator + class LOG4CPLUS_EXPORT Properties { + public: + enum PFlags + { + // These encoding related options occupy 2 bits of the flags + // and are mutually exclusive. These flags are synchronized + // with PCFlags in PropertyConfigurator. + + fEncodingShift = 3 + , fEncodingMask = 0x3 + , fUnspecEncoding = (0 << fEncodingShift) +#if defined (LOG4CPLUS_HAVE_CODECVT_UTF8_FACET) && defined (UNICODE) + , fUTF8 = (1 << fEncodingShift) +#endif +#if (defined (LOG4CPLUS_HAVE_CODECVT_UTF16_FACET) || defined (_WIN32)) \ + && defined (UNICODE) + , fUTF16 = (2 << fEncodingShift) +#endif +#if defined (LOG4CPLUS_HAVE_CODECVT_UTF32_FACET) && defined (UNICODE) + , fUTF32 = (3 << fEncodingShift) +#endif + }; + + Properties(); + explicit Properties(log4cplus::tistream& input); + explicit Properties(const log4cplus::tstring& inputFile, unsigned flags = 0); + virtual ~Properties(); + + // constants + static const tchar PROPERTIES_COMMENT_CHAR; + + // methods + /** + * Tests to see if key can be found in this map. + */ + bool exists(const log4cplus::tstring& key) const; + bool exists(tchar const * key) const; + + /** + * Returns the number of entries in this map. + */ + std::size_t size() const + { + return data.size(); + } + + /** + * Searches for the property with the specified key in this property + * list. If the key is not found in this property list, the default + * property list, and its defaults, recursively, are then checked. + * The method returns null if the property is not found. + */ + log4cplus::tstring const & getProperty(const log4cplus::tstring& key) const; + log4cplus::tstring const & getProperty(tchar const * key) const; + + /** + * Searches for the property with the specified key in this property + * list. If the key is not found in this property list, the default + * property list, and its defaults, recursively, are then checked. + * The method returns the default value argument if the property is + * not found. + */ + log4cplus::tstring getProperty(const log4cplus::tstring& key, + const log4cplus::tstring& defaultVal) const; + + /** + * Returns all the keys in this property list. + */ + std::vector propertyNames() const; + + /** + * Inserts value into this map indexed by key. + */ + void setProperty(const log4cplus::tstring& key, const log4cplus::tstring& value); + + /** + * Removed the property index by key from this map. + */ + bool removeProperty(const log4cplus::tstring& key); + + /** + * Returns a subset of the "properties" whose keys start with + * "prefix". The returned "properties" have "prefix" trimmed from + * their keys. + */ + Properties getPropertySubset(const log4cplus::tstring& prefix) const; + + bool getInt (int & val, log4cplus::tstring const & key) const; + bool getUInt (unsigned & val, log4cplus::tstring const & key) const; + bool getLong (long & val, log4cplus::tstring const & key) const; + bool getULong (unsigned long & val, log4cplus::tstring const & key) const; + bool getBool (bool & val, log4cplus::tstring const & key) const; + + protected: + // Types + typedef std::map StringMap; + + // Methods + void init(log4cplus::tistream& input); + + // Data + StringMap data; + unsigned flags; + + private: + template + log4cplus::tstring const & get_property_worker ( + StringType const & key) const; + + template + bool get_type_val_worker (ValType & val, + log4cplus::tstring const & key) const; + }; + } // end namespace helpers + +} + + +#endif // LOG4CPLUS_HELPERS_PROPERTY_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/queue.h b/src/nar/resources/noarch/include/log4cplus/helpers/queue.h new file mode 100644 index 0000000..eefaf2f --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/queue.h @@ -0,0 +1,158 @@ +// -*- C++ -*- +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_HELPERS_QUEUE_H +#define LOG4CPLUS_HELPERS_QUEUE_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if ! defined (LOG4CPLUS_SINGLE_THREADED) + +#include +#include +#include +#include + + +namespace log4cplus { namespace thread { + + +//! Single consumer, multiple producers queue. +class LOG4CPLUS_EXPORT Queue + : public virtual helpers::SharedObject +{ +public: + //! Type of the state flags field. + typedef unsigned flags_type; + + //! Queue storage type. + typedef std::deque queue_storage_type; + + Queue (unsigned len = 100); + virtual ~Queue (); + + // Producers' methods. + + //! Puts event ev into queue, sets QUEUE flag and + //! sets internal event object into signaled state. If the EXIT + //! flags is already set upon entering the function, nothing is + //! inserted into the queue. The function can block on internal + //! semaphore if the queue has reached maximal allowed + //! length. Calling thread is unblocked either by consumer thread + //! removing item from queue or by any other thread calling + //! signal_exit(). + //! + //! \param ev spi::InternalLoggingEvent to be put into the queue. + //! \return Flags. + flags_type put_event (spi::InternalLoggingEvent const & ev); + + //! Sets EXIT flag and DRAIN flag and sets internal event object + //! into signaled state. + //! \param drain If true, DRAIN flag will be set, otherwise unset. + //! \return Flags, ERROR_BIT can be set upon error. + flags_type signal_exit (bool drain = true); + + // Consumer's methods. + + //! The get_events() function is used by queue's consumer. It + //! fills buf argument and sets EVENT flag in return + //! value. If EXIT flag is already set in flags member upon + //! entering the function then depending on DRAIN flag it either + //! fills buf argument or does not fill the argument, + //! if the queue is non-empty. The function blocks by waiting for + //! internal event object to be signaled if the queue is empty, + //! unless EXIT flag is set. The calling thread is unblocked when + //! items are added into the queue or when exit is signaled using + //! the signal_exit() function. + //! + //! + //! Upon error, return value has one of the error flags set. + //! + //! \param buf Pointer to storage of spi::InternalLoggingEvent + //! instances to be filled from queue. + //! \return Flags. + flags_type get_events (queue_storage_type * buf); + + //! Possible state flags. + enum Flags + { + //! EVENT flag is set in return value of get_event() call if + //! the ev argument is filled with event from the queue. + EVENT = 0x0001, + + //! QUEUE flag is set by producers when they put item into the + //! queue. + QUEUE = 0x0002, + + //! EXIT flag is set by signal_exit() call, signaling that the + //! queue worker thread should end itself. + EXIT = 0x0004, + + //! When DRAIN flag is set together with EXIT flag, the queue + //! worker thread will first drain the queue before exiting. + DRAIN = 0x0008, + + //! ERROR_BIT signals error. + ERROR_BIT = 0x0010, + + //! ERROR_AFTER signals error that has occured after queue has + //! already been touched. + ERROR_AFTER = 0x0020 + }; + +protected: + //! Queue storage. + queue_storage_type queue; + + //! Mutex protecting queue and flags. + Mutex mutex; + + //! Event on which consumer can wait if it finds queue empty. + ManualResetEvent ev_consumer; + + //! Semaphore that limits the queue length. + Semaphore sem; + + //! State flags. + flags_type flags; + +private: + Queue (Queue const &); + Queue & operator = (Queue const &); +}; + + +typedef helpers::SharedObjectPtr QueuePtr; + + +} } // namespace log4cplus { namespace thread { + + +#endif // LOG4CPLUS_SINGLE_THREADED + +#endif // LOG4CPLUS_HELPERS_QUEUE_H diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/sleep.h b/src/nar/resources/noarch/include/log4cplus/helpers/sleep.h new file mode 100644 index 0000000..f3c5636 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/sleep.h @@ -0,0 +1,43 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: sleep.h +// Created: 5/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_SLEEP_HEADER_ +#define LOG4CPLUS_HELPERS_SLEEP_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + + +namespace log4cplus { + namespace helpers { + LOG4CPLUS_EXPORT void sleep(unsigned long secs, + unsigned long nanosecs = 0); + LOG4CPLUS_EXPORT void sleepmillis(unsigned long millis); + } // end namespace helpers +} // end namespace log4cplus + +#endif // LOG4CPLUS_HELPERS_SLEEP_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/snprintf.h b/src/nar/resources/noarch/include/log4cplus/helpers/snprintf.h new file mode 100644 index 0000000..f0dc949 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/snprintf.h @@ -0,0 +1,62 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Zeman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_HELPERS_SNPRINTF_H +#define LOG4CPLUS_HELPERS_SNPRINTF_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include + + +namespace log4cplus { namespace helpers { + + +class LOG4CPLUS_EXPORT snprintf_buf +{ +public: + snprintf_buf (); + + tchar const * print (tchar const * fmt, ...) + LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 2, 3); + + int print_va_list (tchar const * & str, tchar const * fmt, std::va_list) + LOG4CPLUS_FORMAT_ATTRIBUTE (__printf__, 3, 0); + +private: + std::vector buf; +}; + + +} } // namespace log4cplus { namespace helpers + + + +#endif // LOG4CPLUS_HELPERS_SNPRINTF_H diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/socket.h b/src/nar/resources/noarch/include/log4cplus/helpers/socket.h new file mode 100644 index 0000000..b2f7031 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/socket.h @@ -0,0 +1,140 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: socket.h +// Created: 4/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_SOCKET_HEADER_ +#define LOG4CPLUS_HELPERS_SOCKET_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + + +namespace log4cplus { + namespace helpers { + + enum SocketState { ok, + not_opened, + bad_address, + connection_failed, + broken_pipe, + invalid_access_mode, + message_truncated, + accept_interrupted + }; + + typedef std::ptrdiff_t SOCKET_TYPE; + + extern LOG4CPLUS_EXPORT SOCKET_TYPE const INVALID_SOCKET_VALUE; + + class LOG4CPLUS_EXPORT AbstractSocket { + public: + // ctor and dtor + AbstractSocket(); + AbstractSocket(SOCKET_TYPE sock, SocketState state, int err); + AbstractSocket(const AbstractSocket&); + virtual ~AbstractSocket() = 0; + + // methods + /// Close socket + virtual void close(); + virtual bool isOpen() const; + + AbstractSocket& operator=(const AbstractSocket& rhs); + + protected: + // Methods + virtual void copy(const AbstractSocket& rhs); + + // Data + SOCKET_TYPE sock; + SocketState state; + int err; + }; + + + + /** + * This class implements client sockets (also called just "sockets"). + * A socket is an endpoint for communication between two machines. + */ + class LOG4CPLUS_EXPORT Socket : public AbstractSocket { + public: + // ctor and dtor + Socket(); + Socket(SOCKET_TYPE sock, SocketState state, int err); + Socket(const tstring& address, unsigned short port, bool udp = false); + virtual ~Socket(); + + // methods + virtual bool read(SocketBuffer& buffer); + virtual bool write(const SocketBuffer& buffer); + virtual bool write(const std::string & buffer); + }; + + + + /** + * This class implements server sockets. A server socket waits for + * requests to come in over the network. It performs some operation + * based on that request, and then possibly returns a result to the + * requester. + */ + class LOG4CPLUS_EXPORT ServerSocket : public AbstractSocket { + public: + // ctor and dtor + ServerSocket(unsigned short port); + virtual ~ServerSocket(); + + Socket accept(); + void interruptAccept (); + + protected: + std::ptrdiff_t interruptHandles[2]; + }; + + + LOG4CPLUS_EXPORT SOCKET_TYPE openSocket(unsigned short port, SocketState& state); + LOG4CPLUS_EXPORT SOCKET_TYPE connectSocket(const log4cplus::tstring& hostn, + unsigned short port, bool udp, + SocketState& state); + LOG4CPLUS_EXPORT SOCKET_TYPE acceptSocket(SOCKET_TYPE sock, SocketState& state); + LOG4CPLUS_EXPORT int closeSocket(SOCKET_TYPE sock); + + LOG4CPLUS_EXPORT long read(SOCKET_TYPE sock, SocketBuffer& buffer); + LOG4CPLUS_EXPORT long write(SOCKET_TYPE sock, + const SocketBuffer& buffer); + LOG4CPLUS_EXPORT long write(SOCKET_TYPE sock, + const std::string & buffer); + + LOG4CPLUS_EXPORT tstring getHostname (bool fqdn); + LOG4CPLUS_EXPORT int setTCPNoDelay (SOCKET_TYPE, bool); + + } // end namespace helpers +} // end namespace log4cplus + +#endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/socketbuffer.h b/src/nar/resources/noarch/include/log4cplus/helpers/socketbuffer.h new file mode 100644 index 0000000..f8b9613 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/socketbuffer.h @@ -0,0 +1,79 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: socketbuffer.h +// Created: 5/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_ +#define LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + + +namespace log4cplus { +namespace helpers { + +/** + * + */ +class LOG4CPLUS_EXPORT SocketBuffer +{ +public: + explicit SocketBuffer(std::size_t max); + virtual ~SocketBuffer(); + + char *getBuffer() const { return buffer; } + std::size_t getMaxSize() const { return maxsize; } + std::size_t getSize() const { return size; } + void setSize(std::size_t s) { size = s; } + std::size_t getPos() const { return pos; } + + unsigned char readByte(); + unsigned short readShort(); + unsigned int readInt(); + tstring readString(unsigned char sizeOfChar); + + void appendByte(unsigned char val); + void appendShort(unsigned short val); + void appendInt(unsigned int val); + void appendString(const tstring& str); + void appendBuffer(const SocketBuffer& buffer); + +private: + // Data + std::size_t maxsize; + std::size_t size; + std::size_t pos; + char *buffer; + + SocketBuffer(SocketBuffer const & rhs); + SocketBuffer& operator= (SocketBuffer const& rhs); +}; + +} // end namespace helpers +} // end namespace log4cplus + +#endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/stringhelper.h b/src/nar/resources/noarch/include/log4cplus/helpers/stringhelper.h new file mode 100644 index 0000000..0b110d6 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/stringhelper.h @@ -0,0 +1,210 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: stringhelper.h +// Created: 3/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_STRINGHELPER_HEADER_ +#define LOG4CPLUS_HELPERS_STRINGHELPER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +#include +#include + + +namespace log4cplus { + namespace helpers { + + /** + * Returns s in upper case. + */ + LOG4CPLUS_EXPORT log4cplus::tstring toUpper(const log4cplus::tstring& s); + + + /** + * Returns s in lower case. + */ + LOG4CPLUS_EXPORT log4cplus::tstring toLower(const log4cplus::tstring& s); + + + /** + * Tokenize s using c as the delimiter and + * put the resulting tokens in _result. If + * collapseTokens is false, multiple adjacent delimiters + * will result in zero length tokens. + * + * Example: + *
+         *   string s = // Set string with '.' as delimiters
+         *   list tokens;
+         *   tokenize(s, '.', back_insert_iterator >(tokens));
+         * 
+ */ + template + inline + void + tokenize(const StringType& s, typename StringType::value_type c, + OutputIter result, bool collapseTokens = true) + { + typedef typename StringType::size_type size_type; + size_type const slen = s.length(); + size_type first = 0; + size_type i = 0; + for (i=0; i < slen; ++i) + { + if (s[i] == c) + { + *result = StringType (s, first, i - first); + ++result; + if (collapseTokens) + while (i+1 < slen && s[i+1] == c) + ++i; + first = i + 1; + } + } + if (first != i) + *result = StringType (s, first, i - first); + } + + + template + struct ConvertIntegerToStringHelper; + + + template + struct ConvertIntegerToStringHelper + { + static inline + void + step1 (tchar * & it, intType & value) + { + // The sign of the result of the modulo operator is + // implementation defined. That's why we work with + // positive counterpart instead. Also, in twos + // complement arithmetic the smallest negative number + // does not have positive counterpart; the range is + // asymetric. That's why we handle the case of value + // == min() specially here. + if (value == (std::numeric_limits::min) ()) + { + intType const r = value / 10; + intType const a = (-r) * 10; + intType const mod = -(a + value); + value = -r; + + *(it - 1) = static_cast(LOG4CPLUS_TEXT('0') + mod); + --it; + } + else + value = -value; + } + + static inline + bool + is_negative (intType val) + { + return val < 0; + } + }; + + + template + struct ConvertIntegerToStringHelper + { + static inline + void + step1 (tchar * &, intType &) + { + // This will never be called for unsigned types. + } + + static inline + bool + is_negative (intType) + { + return false; + } + }; + + + template + inline + void + convertIntegerToString (tstring & str, intType value) + { + typedef std::numeric_limits intTypeLimits; + typedef ConvertIntegerToStringHelper + HelperType; + + const std::size_t buffer_size + = intTypeLimits::digits10 + 2; + tchar buffer[buffer_size]; + tchar * it = &buffer[buffer_size]; + tchar const * const buf_end = it; + + if (value == 0) + { + --it; + *it = LOG4CPLUS_TEXT('0'); + } + + bool const negative = HelperType::is_negative (value); + if (negative) + HelperType::step1 (it, value); + + for (; value != 0; --it) + { + intType mod = value % 10; + value = value / 10; + *(it - 1) = static_cast(LOG4CPLUS_TEXT('0') + mod); + } + + if (negative) + { + --it; + *it = LOG4CPLUS_TEXT('-'); + } + + str.assign (static_cast(it), buf_end); + } + + + template + inline + tstring + convertIntegerToString (intType value) + { + tstring result; + convertIntegerToString (result, value); + return result; + } + + } // namespace helpers + +} // namespace log4cplus + +#endif // LOG4CPLUS_HELPERS_STRINGHELPER_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/thread-config.h b/src/nar/resources/noarch/include/log4cplus/helpers/thread-config.h new file mode 100644 index 0000000..4f9e063 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/thread-config.h @@ -0,0 +1,61 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: thread-config.h +// Created: 4/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ +#define LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined (LOG4CPLUS_USE_PTHREADS) +# if defined (__APPLE__) +# define LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE +# endif + +#elif defined(LOG4CPLUS_USE_WIN32_THREADS) +# if defined (_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 +# define LOG4CPLUS_USE_SRW_LOCK +# else +# define LOG4CPLUS_POOR_MANS_SHAREDMUTEX +# endif +# undef LOG4CPLUS_HAVE_TLS_SUPPORT +# undef LOG4CPLUS_THREAD_LOCAL_VAR +# if defined (_MSC_VER) && _WIN32_WINNT >= 0x0600 +// The __declspec(thread) functionality is not compatible with LoadLibrary(). +// For more information why see and "Windows and TLS" note in README. +// . +# define LOG4CPLUS_HAVE_TLS_SUPPORT 1 +# define LOG4CPLUS_THREAD_LOCAL_VAR __declspec(thread) +# endif + +#elif defined(LOG4CPLUS_SINGLE_THREADED) +# undef LOG4CPLUS_HAVE_TLS_SUPPORT +# undef LOG4CPLUS_THREAD_LOCAL_VAR + +#else +# error "You Must define a Threading model" + +#endif + + +#endif // LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/helpers/timehelper.h b/src/nar/resources/noarch/include/log4cplus/helpers/timehelper.h new file mode 100644 index 0000000..06b3281 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/helpers/timehelper.h @@ -0,0 +1,179 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: timehelper.h +// Created: 6/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_ +#define LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +#if defined (LOG4CPLUS_HAVE_TIME_H) +#include +#endif + +#include + + +namespace log4cplus { + +namespace helpers { + + +using std::time_t; +using std::tm; + + +/** + * This class represents a Epoch time with microsecond accuracy. + */ +class LOG4CPLUS_EXPORT Time { +public: + Time(); + Time(time_t tv_sec, long tv_usec); + explicit Time(time_t time); + + /** + * Returns the current time using the gettimeofday() + * method if it is available on the current platform. (Not on + * WIN32.) + */ + static Time gettimeofday(); + + // Methods + /** + * Returns seconds value. + */ + time_t sec() const { return tv_sec; } + + /** + * Returns microseconds value. + */ + long usec() const { return tv_usec; } + + /** + * Sets the seconds value. + */ + void sec(time_t s) { tv_sec = s; } + + /** + * Sets the microseconds value. + */ + void usec(long us) { tv_usec = us; } + + /** + * Sets this Time using the mktime function. + */ + time_t setTime(tm* t); + + /** + * Returns this Time as a time_t value. + */ + time_t getTime() const LOG4CPLUS_ATTRIBUTE_PURE; + + /** + * Populates tm using the gmtime() + * function. + */ + void gmtime(tm* t) const; + + /** + * Populates tm using the localtime() + * function. + */ + void localtime(tm* t) const; + + /** + * Returns a string with a "formatted time" specified by + * fmt. It used the strftime() + * function to do this. + * + * Look at your platform's strftime() documentation + * for the formatting options available. + * + * The following additional options are provided:
+ * %q - 3 character field that provides milliseconds + * %Q - 7 character field that provides fractional + * milliseconds. + */ + log4cplus::tstring getFormattedTime(const log4cplus::tstring& fmt, + bool use_gmtime = false) const; + + // Operators + Time& operator+=(const Time& rhs); + Time& operator-=(const Time& rhs); + Time& operator/=(long rhs); + Time& operator*=(long rhs); + +private: + // Data + time_t tv_sec; /* seconds */ + long tv_usec; /* microseconds */ +}; + + +LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator+ + (const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs); +LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator- + (const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs); +LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator/ + (const log4cplus::helpers::Time& lhs, + long rhs); +LOG4CPLUS_EXPORT const log4cplus::helpers::Time operator* + (const log4cplus::helpers::Time& lhs, + long rhs); + +LOG4CPLUS_EXPORT bool operator<(const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs) + LOG4CPLUS_ATTRIBUTE_PURE; +LOG4CPLUS_EXPORT bool operator<=(const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs) + LOG4CPLUS_ATTRIBUTE_PURE; + +LOG4CPLUS_EXPORT bool operator>(const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs) + LOG4CPLUS_ATTRIBUTE_PURE; +LOG4CPLUS_EXPORT bool operator>=(const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs) + LOG4CPLUS_ATTRIBUTE_PURE; + +LOG4CPLUS_EXPORT bool operator==(const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs) + LOG4CPLUS_ATTRIBUTE_PURE; +LOG4CPLUS_EXPORT bool operator!=(const log4cplus::helpers::Time& lhs, + const log4cplus::helpers::Time& rhs) + LOG4CPLUS_ATTRIBUTE_PURE; + +} // namespace helpers + +} // namespace log4cplus + + +#endif // LOG4CPLUS_HELPERS_TIME_HELPER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/hierarchy.h b/src/nar/resources/noarch/include/log4cplus/hierarchy.h new file mode 100644 index 0000000..2c023a9 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/hierarchy.h @@ -0,0 +1,325 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: hierarchy.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HIERARCHY_HEADER_ +#define LOG4CPLUS_HIERARCHY_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include + + +namespace log4cplus { + // Forward Declarations + class HierarchyLocker; + + /** + * This class is specialized in retrieving loggers by name and + * also maintaining the logger hierarchy. + * + * The casual user should not have to deal with this class + * directly. However, if you are in an environment where + * multiple applications run in the same process, then read on. + * + * The structure of the logger hierarchy is maintained by the + * {@link #getInstance} method. The hierarchy is such that children + * link to their parent but parents do not have any pointers to their + * children. Moreover, loggers can be instantiated in any order, in + * particular descendant before ancestor. + * + * In case a descendant is created before a particular ancestor, + * then it creates a provision node for the ancestor and adds itself + * to the provision node. Other descendants of the same ancestor add + * themselves to the previously created provision node. + */ + class LOG4CPLUS_EXPORT Hierarchy + { + public: + // DISABLE_OFF should be set to a value lower than all possible + // priorities. + static const LogLevel DISABLE_OFF; + static const LogLevel DISABLE_OVERRIDE; + + // Ctors + /** + * Create a new Logger hierarchy. + */ + Hierarchy(); + + // Dtor + virtual ~Hierarchy(); + + // Methods + /** + * This call will clear all logger definitions from the internal + * hashtable. Invoking this method will irrevocably mess up the + * logger hierarchy. + * + * You should really know what you are doing before + * invoking this method. + */ + virtual void clear(); + + /** + * Returns true if the named logger exists + * (in the default hierarchy). + * + * @param name The name of the logger to search for. + */ + virtual bool exists(const log4cplus::tstring& name); + + /** + * Similar to {@link #disable(LogLevel)} except that the LogLevel + * argument is given as a log4cplus::tstring. + */ + virtual void disable(const log4cplus::tstring& loglevelStr); + + /** + * Disable all logging requests of LogLevel equal to or + * below the ll parameter p, for + * all loggers in this hierarchy. Logging requests of + * higher LogLevel then p remain unaffected. + * + * Nevertheless, if the + * BasicConfigurator::DISABLE_OVERRIDE_KEY property is set to + * true, then logging requests are evaluated as usual. + * + * The "disable" family of methods are there for speed. They + * allow printing methods such as debug, info, etc. to return + * immediately after an integer comparison without walking the + * logger hierarchy. In most modern computers an integer + * comparison is measured in nanoseconds where as a logger walk is + * measured in units of microseconds. + */ + virtual void disable(LogLevel ll); + + /** + * Disable all logging requests regardless of logger and LogLevel. + * This method is equivalent to calling {@link #disable} with the + * argument FATAL_LOG_LEVEL, the highest possible LogLevel. + */ + virtual void disableAll(); + + /** + * Disable all Debug logging requests regardless of logger. + * This method is equivalent to calling {@link #disable} with the + * argument DEBUG_LOG_LEVEL. + */ + virtual void disableDebug(); + + /** + * Disable all Info logging requests regardless of logger. + * This method is equivalent to calling {@link #disable} with the + * argument INFO_LOG_LEVEL. + */ + virtual void disableInfo(); + + /** + * Undoes the effect of calling any of {@link #disable}, {@link + * #disableAll}, {@link #disableDebug} and {@link #disableInfo} + * methods. More precisely, invoking this method sets the Logger + * class internal variable called disable to its + * default "off" value. + */ + virtual void enableAll(); + + /** + * Return a new logger instance named as the first parameter using + * the default factory. + * + * If a logger of that name already exists, then it will be + * returned. Otherwise, a new logger will be instantiated and + * then linked with its existing ancestors as well as children. + * + * @param name The name of the logger to retrieve. + */ + virtual Logger getInstance(const log4cplus::tstring& name); + + /** + * Return a new logger instance named as the first parameter using + * factory. + * + * If a logger of that name already exists, then it will be + * returned. Otherwise, a new logger will be instantiated by the + * factory parameter and linked with its existing + * ancestors as well as children. + * + * @param name The name of the logger to retrieve. + * @param factory The factory that will make the new logger instance. + */ + virtual Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory); + + /** + * Returns all the currently defined loggers in this hierarchy. + * + * The root logger is not included in the returned list. + */ + virtual LoggerList getCurrentLoggers(); + + /** + * Is the LogLevel specified by level enabled? + */ + virtual bool isDisabled(LogLevel level); + + /** + * Get the root of this hierarchy. + */ + virtual Logger getRoot() const; + + /** + * Reset all values contained in this hierarchy instance to their + * default. This removes all appenders from all loggers, sets + * the LogLevel of all non-root loggers to NOT_SET_LOG_LEVEL, + * sets their additivity flag to true and sets the LogLevel + * of the root logger to DEBUG_LOG_LEVEL. Moreover, message disabling + * is set its default "off" value. + * + * Existing loggers are not removed. They are just reset. + * + * This method should be used sparingly and with care as it will + * block all logging until it is completed.

+ */ + virtual void resetConfiguration(); + + /** + * Set the default LoggerFactory instance. + */ + virtual void setLoggerFactory(std::auto_ptr factory); + + /** + * Returns the default LoggerFactory instance. + */ + virtual spi::LoggerFactory* getLoggerFactory(); + + /** + * Shutting down a hierarchy will safely close and remove + * all appenders in all loggers including the root logger. + * + * Some appenders such as SocketAppender need to be closed before the + * application exits. Otherwise, pending logging events might be + * lost. + * + * The shutdown method is careful to close nested + * appenders before closing regular appenders. This is allows + * configurations where a regular appender is attached to a logger + * and again to a nested appender. + */ + virtual void shutdown(); + + private: + // Types + typedef std::vector ProvisionNode; + typedef std::map ProvisionNodeMap; + typedef std::map LoggerMap; + + // Methods + /** + * This is the implementation of the getInstance() method. + * NOTE: This method does not lock the hashtable_mutex. + */ + LOG4CPLUS_PRIVATE + virtual Logger getInstanceImpl(const log4cplus::tstring& name, + spi::LoggerFactory& factory); + + /** + * This is the implementation of the getCurrentLoggers(). + * NOTE: This method does not lock the hashtable_mutex. + */ + LOG4CPLUS_PRIVATE + virtual void initializeLoggerList(LoggerList& list) const; + + /** + * This method loops through all the *potential* parents of + * logger'. There 3 possible cases: + * + * 1) No entry for the potential parent of 'logger' exists + * + * We create a ProvisionNode for this potential parent and insert + * 'logger' in that provision node. + * + * 2) There is an entry of type Logger for the potential parent. + * + * The entry is 'logger's nearest existing parent. We update logger's + * parent field with this entry. We also break from the loop + * because updating our parent's parent is our parent's + * responsibility. + * + * 3) There entry is of type ProvisionNode for this potential parent. + * + * We add 'logger' to the list of children for this potential parent. + */ + LOG4CPLUS_PRIVATE void updateParents(Logger const & logger); + + /** + * We update the links for all the children that placed themselves + * in the provision node 'pn'. The second argument 'logger' is a + * reference for the newly created Logger, parent of all the + * children in 'pn' + * + * We loop on all the children 'c' in 'pn': + * + * If the child 'c' has been already linked to a child of + * 'logger' then there is no need to update 'c'. + * + * Otherwise, we set logger's parent field to c's parent and set + * c's parent field to logger. + */ + LOG4CPLUS_PRIVATE void updateChildren(ProvisionNode& pn, + Logger const & logger); + + // Data + thread::Mutex hashtable_mutex; + std::auto_ptr defaultFactory; + ProvisionNodeMap provisionNodes; + LoggerMap loggerPtrs; + Logger root; + + int disableValue; + + bool emittedNoAppenderWarning; + + // Disallow copying of instances of this class + Hierarchy(const Hierarchy&); + Hierarchy& operator=(const Hierarchy&); + + // Friends + friend class log4cplus::spi::LoggerImpl; + friend class log4cplus::HierarchyLocker; + }; + + + LOG4CPLUS_EXPORT Hierarchy & getDefaultHierarchy (); + + +} // end namespace log4cplus + +#endif // LOG4CPLUS_HIERARCHY_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/hierarchylocker.h b/src/nar/resources/noarch/include/log4cplus/hierarchylocker.h new file mode 100644 index 0000000..ed27664 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/hierarchylocker.h @@ -0,0 +1,80 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: hierarchylocker.h +// Created: 8/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_HIERARCHY_LOCKER_HEADER_ +#define LOG4CPLUS_HIERARCHY_LOCKER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include + + +namespace log4cplus +{ + + class Hierarchy; + + + /** + * This is used to lock a Hierarchy. The dtor unlocks the Hierarchy. + */ + class LOG4CPLUS_EXPORT HierarchyLocker { + public: + // ctor & dtor + HierarchyLocker(Hierarchy& h); + ~HierarchyLocker(); + + /** + * Calls the resetConfiguration() method on the locked Hierarchy. + */ + void resetConfiguration(); + + /** + * Calls the getInstance() method on the locked Hierarchy. + */ + Logger getInstance(const log4cplus::tstring& name); + + /** + * Calls the getInstance() method on the locked Hierarchy. + */ + Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory); + + void addAppender(Logger &logger, log4cplus::SharedAppenderPtr& appender); + + private: + // Data + Hierarchy& h; + log4cplus::thread::MutexGuard hierarchyLocker; + LoggerList loggerList; + }; + +} // end namespace log4cplus + +#endif // LOG4CPLUS_HIERARCHY_LOCKER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/internal/cygwin-win32.h b/src/nar/resources/noarch/include/log4cplus/internal/cygwin-win32.h new file mode 100644 index 0000000..ab5a744 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/internal/cygwin-win32.h @@ -0,0 +1,54 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: cygwin-win32.h +// Created: 7/2011 +// Author: Vaclav Zeman +// +// Copyright (C) 2011-2013, Vaclav Zeman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#if ! defined (LOG4CPLUS_CONFIG_CYGWIN_WIN32_H) +#define LOG4CPLUS_CONFIG_CYGWIN_WIN32_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined (__CYGWIN__) + +#if ! defined (INSIDE_LOG4CPLUS) +# error "This header must not be be used outside log4cplus' implementation files." +#endif + + +namespace log4cplus { namespace cygwin { + +unsigned long get_current_win32_thread_id (); + +} } // namespace log4cplus { namespace cygwin { + + +#endif // defined (__CYGWIN__) +#endif // LOG4CPLUS_CONFIG_CYGWIN_WIN32_H diff --git a/src/nar/resources/noarch/include/log4cplus/internal/env.h b/src/nar/resources/noarch/include/log4cplus/internal/env.h new file mode 100644 index 0000000..8c9a364 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/internal/env.h @@ -0,0 +1,87 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: env.h +// Created: 7/2010 +// Author: Vaclav Haisman +// +// +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_INTERNAL_ENV_H +#define LOG4CPLUS_INTERNAL_ENV_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +#if defined (_WIN32) +#include +#endif +#ifdef LOG4CPLUS_HAVE_SYS_TYPES_H +#include +#endif +#ifdef LOG4CPLUS_HAVE_UNISTD_H +#include +#endif + + +namespace log4cplus { namespace internal { + + +bool get_env_var (tstring & value, tstring const & name); +bool parse_bool (bool & val, tstring const & str); + +inline +#if defined (_WIN32) +DWORD +get_process_id () +{ + return GetCurrentProcessId (); +} + +#elif defined (LOG4CPLUS_HAVE_GETPID) +pid_t +get_process_id () +{ + return getpid (); +} + +#else +int +get_process_id () +{ + return 0; +} + +#endif + + +} } // namespace log4cplus { namespace internal { + + +#endif // LOG4CPLUS_INTERNAL_ENV_H diff --git a/src/nar/resources/noarch/include/log4cplus/internal/internal.h b/src/nar/resources/noarch/include/log4cplus/internal/internal.h new file mode 100644 index 0000000..97a8aab --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/internal/internal.h @@ -0,0 +1,251 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: internal.h +// Created: 1/2009 +// Author: Vaclav Haisman +// +// +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/** @file + * This header contains declaration internal to log4cplus. They must never be + * visible from user accesible headers or exported in DLL/shared libray. + */ + + +#ifndef LOG4CPLUS_INTERNAL_INTERNAL_HEADER_ +#define LOG4CPLUS_INTERNAL_INTERNAL_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if ! defined (INSIDE_LOG4CPLUS) +# error "This header must not be be used outside log4cplus' implementation files." +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace log4cplus { + +namespace internal { + + +//! Canonical empty string. It is used when the need to return empty string +//! by reference arises. +extern log4cplus::tstring const empty_str; + + +struct gft_scratch_pad +{ + gft_scratch_pad (); + ~gft_scratch_pad (); + + void + reset () + { + uc_q_str_valid = false; + q_str_valid = false; + s_str_valid = false; + ret.clear (); + } + + log4cplus::tstring q_str; + log4cplus::tstring uc_q_str; + log4cplus::tstring s_str; + log4cplus::tstring ret; + log4cplus::tstring fmt; + log4cplus::tstring tmp; + std::vector buffer; + bool uc_q_str_valid; + bool q_str_valid; + bool s_str_valid; +}; + + +struct appender_sratch_pad +{ + appender_sratch_pad (); + ~appender_sratch_pad (); + + tostringstream oss; + tstring str; + std::string chstr; +}; + + +//! Per thread data. +struct per_thread_data +{ + per_thread_data (); + ~per_thread_data (); + + tostringstream macros_oss; + tostringstream layout_oss; + DiagnosticContextStack ndc_dcs; + MappedDiagnosticContextMap mdc_map; + log4cplus::tstring thread_name; + log4cplus::tstring thread_name2; + gft_scratch_pad gft_sp; + appender_sratch_pad appender_sp; + log4cplus::tstring faa_str; + log4cplus::tstring ll_str; + spi::InternalLoggingEvent forced_log_ev; + std::FILE * fnull; + log4cplus::helpers::snprintf_buf snprintf_buf; +}; + + +per_thread_data * alloc_ptd (); + +// TLS key whose value is pointer struct per_thread_data. +extern log4cplus::thread::impl::tls_key_type tls_storage_key; + + +#if ! defined (LOG4CPLUS_SINGLE_THREADED) \ + && defined (LOG4CPLUS_THREAD_LOCAL_VAR) + +extern LOG4CPLUS_THREAD_LOCAL_VAR per_thread_data * ptd; + + +inline +void +set_ptd (per_thread_data * p) +{ + ptd = p; +} + + +//! The default value of the \param alloc is false for Win32 DLL builds +//! since per thread data are already initialized by DllMain(). +inline +per_thread_data * +get_ptd (bool alloc +#if defined (_WIN32) && defined (LOG4CPLUS_BUILD_DLL) + = false +#else + = true +#endif + ) +{ + if (LOG4CPLUS_UNLIKELY (! ptd && alloc)) + return alloc_ptd (); + + // The assert() does not belong here. get_ptd() might be called by + // cleanup code that can handle the returned NULL pointer. + //assert (ptd); + + return ptd; +} + + +#else // defined (LOG4CPLUS_THREAD_LOCAL_VAR) + + +inline +void +set_ptd (per_thread_data * p) +{ + thread::impl::tls_set_value (tls_storage_key, p); +} + + +inline +per_thread_data * +get_ptd (bool alloc = true) +{ + per_thread_data * ptd + = reinterpret_cast( + thread::impl::tls_get_value (tls_storage_key)); + + if (LOG4CPLUS_UNLIKELY (! ptd && alloc)) + return alloc_ptd (); + + return ptd; +} + + +#endif // defined (LOG4CPLUS_THREAD_LOCAL_VAR) + + +inline +tstring & +get_thread_name_str () +{ + return get_ptd ()->thread_name; +} + + +inline +tstring & +get_thread_name2_str () +{ + return get_ptd ()->thread_name2; +} + + +inline +gft_scratch_pad & +get_gft_scratch_pad () +{ + return get_ptd ()->gft_sp; +} + + +inline +appender_sratch_pad & +get_appender_sp () +{ + return get_ptd ()->appender_sp; +} + + +} // namespace internal { + + +namespace detail +{ + +LOG4CPLUS_EXPORT void clear_tostringstream (tostringstream &); + +} // namespace detail + + +} // namespace log4cplus { + + +#endif // LOG4CPLUS_INTERNAL_INTERNAL_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/internal/socket.h b/src/nar/resources/noarch/include/log4cplus/internal/socket.h new file mode 100644 index 0000000..e1402e3 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/internal/socket.h @@ -0,0 +1,118 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: socket.h +// Created: 1/2010 +// Author: Vaclav Haisman +// +// +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/** @file + * This header contains declaration internal to log4cplus. They must never be + * visible from user accesible headers or exported in DLL/shared libray. + */ + + +#ifndef LOG4CPLUS_INTERNAL_SOCKET_H_ +#define LOG4CPLUS_INTERNAL_SOCKET_H_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if ! defined (INSIDE_LOG4CPLUS) +# error "This header must not be be used outside log4cplus' implementation files." +#endif + +#if defined(_WIN32) +#include +#endif +#include + +#include +#ifdef LOG4CPLUS_HAVE_ERRNO_H +#include +#endif + + +namespace log4cplus { + +namespace helpers { + + +#if defined(_WIN32) +typedef SOCKET os_socket_type; +#else +typedef int os_socket_type; +#endif + + +os_socket_type const INVALID_OS_SOCKET_VALUE +#if defined(_WIN32) + = INVALID_SOCKET; +#else + = -1; +#endif + + +static inline +os_socket_type +to_os_socket (SOCKET_TYPE const & x) +{ + return static_cast(x); +} + + +static inline +SOCKET_TYPE +to_log4cplus_socket (os_socket_type const & x) +{ + return static_cast(x); +} + + +static inline +void +set_last_socket_error (int err) +{ + errno = err; +} + + +static inline +int +get_last_socket_error () +{ + return errno; +} + + +} // namespace helpers { + +} // namespace log4cplus { + + +#endif // LOG4CPLUS_INTERNAL_SOCKET_H_ diff --git a/src/nar/resources/noarch/include/log4cplus/layout.h b/src/nar/resources/noarch/include/log4cplus/layout.h new file mode 100644 index 0000000..7a21000 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/layout.h @@ -0,0 +1,599 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: Layout.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_LAYOUT_HEADER_ +#define LOG4CPLUS_LAYOUT_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include + +#include + + +namespace log4cplus { + + // Forward Declarations + namespace pattern + { + + class PatternConverter; + + } + + + namespace helpers + { + + class Properties; + class Time; + + } + + + namespace spi + { + + class InternalLoggingEvent; + + } + + + /** + * This class is used to layout strings sent to an {@link + * log4cplus::Appender}. + */ + class LOG4CPLUS_EXPORT Layout + { + public: + Layout(); + Layout(const helpers::Properties& properties); + virtual ~Layout() = 0; + + virtual void formatAndAppend(log4cplus::tostream& output, + const log4cplus::spi::InternalLoggingEvent& event) = 0; + + protected: + LogLevelManager& llmCache; + + private: + // Disable copy + Layout(const Layout&); + Layout& operator=(Layout const &); + }; + + + + /** + * SimpleLayout consists of the LogLevel of the log statement, + * followed by " - " and then the log message itself. For example, + * + *
+     *         DEBUG - Hello world
+     * 
+ * + * {@link PatternLayout} offers a much more powerful alternative. + */ + class LOG4CPLUS_EXPORT SimpleLayout + : public Layout + { + public: + SimpleLayout(); + SimpleLayout(const log4cplus::helpers::Properties& properties); + virtual ~SimpleLayout(); + + virtual void formatAndAppend(log4cplus::tostream& output, + const log4cplus::spi::InternalLoggingEvent& event); + + private: + // Disallow copying of instances of this class + SimpleLayout(const SimpleLayout&); + SimpleLayout& operator=(const SimpleLayout&); + }; + + + + /** + * TTCC layout format consists of time, thread, Logger and nested + * diagnostic context information, hence the name. + * + * The time format depends on the DateFormat used. Use the + * Use_gmtime to specify whether messages should be logged using + * localtime or gmtime. + * + * Here is an example TTCCLayout output: + * + *
+     * 176 [main] INFO  org.apache.log4j.examples.Sort - Populating an array of 2 elements in reverse order.
+     * 225 [main] INFO  org.apache.log4j.examples.SortAlgo - Entered the sort method.
+     * 262 [main] DEBUG org.apache.log4j.examples.SortAlgo.OUTER i=1 - Outer loop.
+     * 276 [main] DEBUG org.apache.log4j.examples.SortAlgo.SWAP i=1 j=0 - Swapping intArray[0] = 1 and intArray[1] = 0
+     * 290 [main] DEBUG org.apache.log4j.examples.SortAlgo.OUTER i=0 - Outer loop.
+     * 304 [main] INFO  org.apache.log4j.examples.SortAlgo.DUMP - Dump of interger array:
+     * 317 [main] INFO  org.apache.log4j.examples.SortAlgo.DUMP - Element [0] = 0
+     * 331 [main] INFO  org.apache.log4j.examples.SortAlgo.DUMP - Element [1] = 1
+     * 343 [main] INFO  org.apache.log4j.examples.Sort - The next log statement should be an error message.
+     * 346 [main] ERROR org.apache.log4j.examples.SortAlgo.DUMP - Tried to dump an uninitialized array.
+     * 467 [main] INFO  org.apache.log4j.examples.Sort - Exiting main method.
+     * 
+ * + * The first field is the number of milliseconds elapsed since the + * start of the program. The second field is the thread outputting the + * log statement. The third field is the LogLevel, the fourth field is + * the logger to which the statement belongs. + * + * The fifth field (just before the '-') is the nested diagnostic + * context. Note the nested diagnostic context may be empty as in the + * first two statements. The text after the '-' is the message of the + * statement. + * + * PatternLayout offers a much more flexible alternative. + */ + class LOG4CPLUS_EXPORT TTCCLayout + : public Layout + { + public: + // Ctor and dtor + TTCCLayout(bool use_gmtime = false); + TTCCLayout(const log4cplus::helpers::Properties& properties); + virtual ~TTCCLayout(); + + virtual void formatAndAppend(log4cplus::tostream& output, + const log4cplus::spi::InternalLoggingEvent& event); + + protected: + log4cplus::tstring dateFormat; + bool use_gmtime; + + private: + // Disallow copying of instances of this class + TTCCLayout(const TTCCLayout&); + TTCCLayout& operator=(const TTCCLayout&); + }; + + + LOG4CPLUS_EXPORT helpers::Time const & getTTCCLayoutTimeBase (); + + + /** + * A flexible layout configurable with pattern string. + * + * The goal of this class is to format a InternalLoggingEvent and return + * the results as a string. The results depend on the conversion + * pattern. + * + * The conversion pattern is closely related to the conversion + * pattern of the printf function in C. A conversion pattern is + * composed of literal text and format control expressions called + * conversion specifiers. + * + * You are free to insert any literal text within the conversion + * pattern. + * + * Each conversion specifier starts with a percent sign (%%) and is + * followed by optional format modifiers and a conversion + * character. The conversion character specifies the type of + * data, e.g. Logger, LogLevel, date, thread name. The format + * modifiers control such things as field width, padding, left and + * right justification. The following is a simple example. + * + * Let the conversion pattern be "%-5p [%t]: %m%n" and assume + * that the log4cplus environment was set to use a PatternLayout. Then the + * statements + *
+     * Logger root = Logger.getRoot();
+     * LOG4CPLUS_DEBUG(root, "Message 1");
+     * LOG4CPLUS_WARN(root, "Message 2");
+     * 
+ * would yield the output + *
+     * DEBUG [main]: Message 1
+     * WARN  [main]: Message 2  
+     * 
+ * + * Note that there is no explicit separator between text and + * conversion specifiers. The pattern parser knows when it has reached + * the end of a conversion specifier when it reads a conversion + * character. In the example above the conversion specifier + * "%-5p" means the LogLevel of the logging event should be left + * justified to a width of five characters. + * + * The recognized conversion characters are + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Conversion CharacterEffect
bUsed to output file name component of path name. + * E.g. main.cxx from path ../../main.cxx.
cUsed to output the logger of the logging event. The + * logger conversion specifier can be optionally followed by + * precision specifier, that is a decimal constant in + * brackets. + * + * If a precision specifier is given, then only the corresponding + * number of right most components of the logger name will be + * printed. By default the logger name is printed in full. + * + * For example, for the logger name "a.b.c" the pattern + * %c{2} will output "b.c". + * + *
dUsed to output the date of the logging event in UTC. + * + * The date conversion specifier may be followed by a date format + * specifier enclosed between braces. For example, %%d{%%H:%%M:%%s} + * or %%d{%%d %%b %%Y %%H:%%M:%%s}. If no date format + * specifier is given then %%d{%%d %%m %%Y %%H:%%M:%%s} + * is assumed. + * + * The Following format options are possible: + *
    + *
  • %%a -- Abbreviated weekday name
  • + *
  • %%A -- Full weekday name
  • + *
  • %%b -- Abbreviated month name
  • + *
  • %%B -- Full month name
  • + *
  • %%c -- Standard date and time string
  • + *
  • %%d -- Day of month as a decimal(1-31)
  • + *
  • %%H -- Hour(0-23)
  • + *
  • %%I -- Hour(1-12)
  • + *
  • %%j -- Day of year as a decimal(1-366)
  • + *
  • %%m -- Month as decimal(1-12)
  • + *
  • %%M -- Minute as decimal(0-59)
  • + *
  • %%p -- Locale's equivalent of AM or PM
  • + *
  • %%q -- milliseconds as decimal(0-999) -- Log4CPLUS specific + *
  • %%Q -- fractional milliseconds as decimal(0-999.999) -- Log4CPLUS specific + *
  • %%S -- Second as decimal(0-59)
  • + *
  • %%U -- Week of year, Sunday being first day(0-53)
  • + *
  • %%w -- Weekday as a decimal(0-6, Sunday being 0)
  • + *
  • %%W -- Week of year, Monday being first day(0-53)
  • + *
  • %%x -- Standard date string
  • + *
  • %%X -- Standard time string
  • + *
  • %%y -- Year in decimal without century(0-99)
  • + *
  • %%Y -- Year including century as decimal
  • + *
  • %%Z -- Time zone name
  • + *
  • %% -- The percent sign
  • + *
+ * + * Lookup the documentation for the strftime() function + * found in the <ctime> header for more information. + *
DUsed to output the date of the logging event in local time. + * + * All of the above information applies. + *
FUsed to output the file name where the logging request was + * issued. + * + * NOTE Unlike log4j, there is no performance penalty for + * calling this method.
hUsed to output the hostname of this system (as returned + * by gethostname(2)). + * + * NOTE The hostname is only retrieved once at + * initialization. + * + *
HUsed to output the fully-qualified domain name of this + * system (as returned by gethostbyname(2) for the hostname + * returned by gethostname(2)). + * + * NOTE The hostname is only retrieved once at + * initialization. + * + *
lEquivalent to using "%F:%L" + * + * NOTE: Unlike log4j, there is no performance penalty for + * calling this method. + * + *
LUsed to output the line number from where the logging request + * was issued. + * + * NOTE: Unlike log4j, there is no performance penalty for + * calling this method. + * + *
mUsed to output the application supplied message associated with + * the logging event.
MUsed to output function name using + * __FUNCTION__ or similar macro. + * + * NOTE The __FUNCTION__ macro is not + * standard but it is common extension provided by all compilers + * (as of 2010). In case it is missing or in case this feature + * is disabled using the + * LOG4CPLUS_DISABLE_FUNCTION_MACRO macro, %M + * expands to an empty string.
nOutputs the platform dependent line separator character or + * characters. + *
pUsed to output the LogLevel of the logging event.
rUsed to output miliseconds since program start + * of the logging event.
tUsed to output the name of the thread that generated the + * logging event.
TUsed to output alternative name of the thread that generated the + * logging event.
iUsed to output the process ID of the process that generated the + * logging event.
xUsed to output the NDC (nested diagnostic context) associated + * with the thread that generated the logging event. + *
"%%"The sequence "%%" outputs a single percent sign. + *
+ * + * By default the relevant information is output as is. However, + * with the aid of format modifiers it is possible to change the + * minimum field width, the maximum field width and justification. + * + * The optional format modifier is placed between the percent sign + * and the conversion character. + * + * The first optional format modifier is the left justification + * flag which is just the minus (-) character. Then comes the + * optional minimum field width modifier. This is a decimal + * constant that represents the minimum number of characters to + * output. If the data item requires fewer characters, it is padded on + * either the left or the right until the minimum width is + * reached. The default is to pad on the left (right justify) but you + * can specify right padding with the left justification flag. The + * padding character is space. If the data item is larger than the + * minimum field width, the field is expanded to accommodate the + * data. The value is never truncated. + * + * This behavior can be changed using the maximum field + * width modifier which is designated by a period followed by a + * decimal constant. If the data item is longer than the maximum + * field, then the extra characters are removed from the + * beginning of the data item and not from the end. For + * example, it the maximum field width is eight and the data item is + * ten characters long, then the first two characters of the data item + * are dropped. This behavior deviates from the printf function in C + * where truncation is done from the end. + * + * Below are various format modifier examples for the logger + * conversion specifier. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Format modifierleft justifyminimum widthmaximum widthcomment
%20cfalse20noneLeft pad with spaces if the logger name is less than 20 + * characters long. + *
%-20c true 20 none Right pad with + * spaces if the logger name is less than 20 characters long. + *
%.30cNAnone30Truncate from the beginning if the logger name is longer than 30 + * characters. + *
%20.30cfalse2030Left pad with spaces if the logger name is shorter than 20 + * characters. However, if logger name is longer than 30 characters, + * then truncate from the beginning. + *
%-20.30ctrue2030Right pad with spaces if the logger name is shorter than 20 + * characters. However, if logger name is longer than 30 characters, + * then truncate from the beginning. + *
+ * + * Below are some examples of conversion patterns. + * + *
+ * + *
"%r [%t] %-5p %c %x - %m%n" + *
This is essentially the TTCC layout. + * + *
"%-6r [%15.15t] %-5p %30.30c %x - %m%n" + * + *
Similar to the TTCC layout except that the relative time is + * right padded if less than 6 digits, thread name is right padded if + * less than 15 characters and truncated if longer and the logger + * name is left padded if shorter than 30 characters and truncated if + * longer. + * + *
+ * + * The above text is largely inspired from Peter A. Darnell and + * Philip E. Margolis' highly recommended book "C -- a Software + * Engineering Approach", ISBN 0-387-97389-3. + * + *

Properties

+ * + *
+ *
NDCMaxDepth
+ *
This property limits how many deepest NDC components will + * be printed by %%x specifier.
+ * + *
ConversionPattern
+ *
This property specifies conversion pattern.
+ *
+ * + */ + class LOG4CPLUS_EXPORT PatternLayout + : public Layout + { + public: + // Ctors and dtor + PatternLayout(const log4cplus::tstring& pattern); + PatternLayout(const log4cplus::helpers::Properties& properties); + virtual ~PatternLayout(); + + virtual void formatAndAppend(log4cplus::tostream& output, + const log4cplus::spi::InternalLoggingEvent& event); + + protected: + void init(const log4cplus::tstring& pattern, unsigned ndcMaxDepth = 0); + + // Data + log4cplus::tstring pattern; + std::vector parsedPattern; + + private: + // Disallow copying of instances of this class + PatternLayout(const PatternLayout&); + PatternLayout& operator=(const PatternLayout&); + }; + + + +} // end namespace log4cplus + +#endif // LOG4CPLUS_LAYOUT_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/log4judpappender.h b/src/nar/resources/noarch/include/log4cplus/log4judpappender.h new file mode 100644 index 0000000..51302c7 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/log4judpappender.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +// Module: LOG4CPLUS +// File: log4judpappender.h +// Created: 7/2012 +// Author: Siva Chandran P +// +// +// Copyright 2012-2013 Siva Chandran P +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_ +#define LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_ + +#include +#include +#include + +namespace log4cplus { + + /** + * Sends log events as Log4j XML to a remote a log server. + * + * The Log4jUdpAppender has the following properties: + * + *
    + *
  • Remote logging is non-intrusive as far as the log event + * is concerned. In other words, the event will be logged with + * the same time stamp, NDC, location info as if it were logged + * locally by the client.
  • + * + *
  • Remote logging uses the UDP protocol.
  • + *
+ * + *

Properties

+ *
+ *
host
+ *
Remote host name to connect and send events to.
+ * + *
port
+ *
Port on remote host to send events to.
+ * + *
+ */ + class LOG4CPLUS_EXPORT Log4jUdpAppender : public Appender { + public: + // Ctors + Log4jUdpAppender(const log4cplus::tstring& host, int port); + Log4jUdpAppender(const log4cplus::helpers::Properties & properties); + + // Dtor + ~Log4jUdpAppender(); + + // Methods + virtual void close(); + + protected: + void openSocket(); + virtual void append(const spi::InternalLoggingEvent& event); + + // Data + log4cplus::helpers::Socket socket; + log4cplus::tstring host; + int port; + + private: + // Disallow copying of instances of this class + Log4jUdpAppender(const Log4jUdpAppender&); + Log4jUdpAppender& operator=(const Log4jUdpAppender&); + }; +} // end namespace log4cplus + +#endif // LOG4CPLUS_LOG4J_UDP_APPENDER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/logger.h b/src/nar/resources/noarch/include/log4cplus/logger.h new file mode 100644 index 0000000..d039761 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/logger.h @@ -0,0 +1,321 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: logger.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file + * This header defines the Logger class and the logging macros. */ + +#ifndef LOG4CPLUS_LOGGERHEADER_ +#define LOG4CPLUS_LOGGERHEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include + +#include + + +namespace log4cplus +{ + // Forward declarations + + class Appender; + class Hierarchy; + class HierarchyLocker; + class DefaultLoggerFactory; + + namespace spi + { + + class LoggerImpl; + + } + + + /** \typedef std::vector LoggerList + * This is a list of {@link Logger Loggers}. */ + typedef std::vector LoggerList; + + + /** + * This is the central class in the log4cplus package. One of the + * distintive features of log4cplus are hierarchical loggers and their + * evaluation. + * + * See the user manual for an + * introduction on this class. + */ + class LOG4CPLUS_EXPORT Logger + : public log4cplus::spi::AppenderAttachable + { + public: + // Static Methods + /** + * Returns true if the named logger exists + * (in the default hierarchy). + * + * @param name The name of the logger to search for. + */ + static bool exists(const log4cplus::tstring& name); + + /* + * Returns all the currently defined loggers in the default + * hierarchy. + * + * The root logger is not included in the returned + * list. + */ + static LoggerList getCurrentLoggers(); + + /** + * Return the default Hierarchy instance. + */ + static Hierarchy& getDefaultHierarchy(); + + /** + * Retrieve a logger with name name. If the named + * logger already exists, then the existing instance will be returned. + * Otherwise, a new instance is created. + * + * By default, loggers do not have a set LogLevel but inherit + * it from the hierarchy. This is one of the central features of + * log4cplus. + * + * @param name The name of the logger to retrieve. + */ + static Logger getInstance(const log4cplus::tstring& name); + + /** + * Like getInstance() except that the type of logger + * instantiated depends on the type returned by the {@link + * spi::LoggerFactory#makeNewLoggerInstance} method of the + * factory parameter. + * + * This method is intended to be used by sub-classes. + * + * @param name The name of the logger to retrieve. + * @param factory A {@link spi::LoggerFactory} implementation that will + * actually create a new Instance. + */ + static Logger getInstance(const log4cplus::tstring& name, spi::LoggerFactory& factory); + + /** + * Return the root of the default logger hierrachy. + * + * The root logger is always instantiated and available. It's + * name is "root". + * + * Nevertheless, calling {@link #getInstance + * Logger.getInstance("root")} does not retrieve the root logger + * but a logger just under root named "root". + */ + static Logger getRoot(); + + /** + * Calling this method will safely close and remove all + * appenders in all the loggers including root contained in the + * default hierachy. + * + * Some appenders such as SocketAppender need to be closed before the + * application exits. Otherwise, pending logging events might be + * lost. + * + * The shutdown method is careful to close nested + * appenders before closing regular appenders. This is allows + * configurations where a regular appender is attached to a logger + * and again to a nested appender. + */ + static void shutdown(); + + // Non-Static Methods + /** + * If assertionVal parameter is false, then + * logs msg with FATAL_LOG_LEVEL log level. + * + * @param assertionVal Truth value of assertion condition. + * @param msg The message to print if assertion is + * false. + */ + void assertion(bool assertionVal, const log4cplus::tstring& msg) const; + + /** + * Close all attached appenders implementing the AppenderAttachable + * interface. + */ + void closeNestedAppenders() const; + + /** + * Check whether this logger is enabled for a given + * LogLevel passed as parameter. + * + * @return boolean True if this logger is enabled for ll. + */ + bool isEnabledFor(LogLevel ll) const; + + /** + * This generic form is intended to be used by wrappers. + */ + void log(LogLevel ll, const log4cplus::tstring& message, + const char* file=NULL, int line=-1) const; + + void log(spi::InternalLoggingEvent const &) const; + + /** + * This method creates a new logging event and logs the event + * without further checks. + */ + void forcedLog(LogLevel ll, const log4cplus::tstring& message, + const char* file=NULL, int line=-1) const; + + void forcedLog(spi::InternalLoggingEvent const &) const; + + /** + * Call the appenders in the hierrachy starting at + * this. If no appenders could be found, emit a + * warning. + * + * This method calls all the appenders inherited from the + * hierarchy circumventing any evaluation of whether to log or not + * to log the particular log request. + * + * @param event the event to log. + */ + void callAppenders(const spi::InternalLoggingEvent& event) const; + + /** + * Starting from this logger, search the logger hierarchy for a + * "set" LogLevel and return it. Otherwise, return the LogLevel of the + * root logger. + * + * The Logger class is designed so that this method executes as + * quickly as possible. + */ + LogLevel getChainedLogLevel() const; + + /** + * Returns the assigned LogLevel, if any, for this Logger. + * + * @return LogLevel - the assigned LogLevel, can be NOT_SET_LOG_LEVEL. + */ + LogLevel getLogLevel() const; + + /** + * Set the LogLevel of this Logger. + */ + void setLogLevel(LogLevel ll); + + /** + * Return the the {@link Hierarchy} where this Logger instance is + * attached. + */ + Hierarchy& getHierarchy() const; + + /** + * Return the logger name. + */ + log4cplus::tstring const & getName() const; + + /** + * Get the additivity flag for this Logger instance. + */ + bool getAdditivity() const; + + /** + * Set the additivity flag for this Logger instance. + */ + void setAdditivity(bool additive); + + // AppenderAttachable Methods + virtual void addAppender(SharedAppenderPtr newAppender); + + virtual SharedAppenderPtrList getAllAppenders(); + + virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name); + + virtual void removeAllAppenders(); + + virtual void removeAppender(SharedAppenderPtr appender); + + virtual void removeAppender(const log4cplus::tstring& name); + + Logger (); + Logger(const Logger& rhs); + Logger& operator=(const Logger& rhs); +#if defined (LOG4CPLUS_HAVE_RVALUE_REFS) + Logger (Logger && rhs); + Logger & operator = (Logger && rhs); +#endif + virtual ~Logger(); + + void swap (Logger &); + + /** + * Used to retrieve the parent of this Logger in the + * Logger tree. + */ + Logger getParent() const; + + protected: + // Data + /** This is a pointer to the implementation class. */ + spi::LoggerImpl * value; + + private: + // Ctors + /** + * This constructor created a new Logger instance + * with a pointer to a Logger implementation. + * + * You should not create loggers directly. + * + * @param ptr A pointer to the Logger implementation. This value + * cannot be NULL. + */ + LOG4CPLUS_PRIVATE Logger(spi::LoggerImpl * ptr); + + // Friends + friend class log4cplus::spi::LoggerImpl; + friend class log4cplus::Hierarchy; + friend class log4cplus::HierarchyLocker; + friend class log4cplus::DefaultLoggerFactory; + }; + + + /** + * This class is used to create the default implementation of + * the Logger class + */ + class LOG4CPLUS_EXPORT DefaultLoggerFactory : public spi::LoggerFactory { + public: + Logger makeNewLoggerInstance(const log4cplus::tstring& name, Hierarchy& h); + }; + + +} // end namespace log4cplus + + +#endif // LOG4CPLUS_LOGGERHEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/loggingmacros.h b/src/nar/resources/noarch/include/log4cplus/loggingmacros.h new file mode 100644 index 0000000..4177388 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/loggingmacros.h @@ -0,0 +1,459 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: loggingmacros.h +// Created: 8/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file + * This header defines the logging macros. */ + +#ifndef LOG4CPLUS_LOGGING_MACROS_HEADER_ +#define LOG4CPLUS_LOGGING_MACROS_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include + + +#if defined(_MSC_VER) +#define LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \ + __pragma (warning (push)) \ + __pragma (warning (disable:4127)) + +#define LOG4CPLUS_RESTORE_DOWHILE_WARNING() \ + __pragma (warning (pop)) + +#else +#define LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() /* empty */ +#define LOG4CPLUS_RESTORE_DOWHILE_WARNING() /* empty */ + +#endif + +#define LOG4CPLUS_DOWHILE_NOTHING() \ + LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \ + do { } while (0) \ + LOG4CPLUS_RESTORE_DOWHILE_WARNING() + +#if defined(LOG4CPLUS_DISABLE_FATAL) && !defined(LOG4CPLUS_DISABLE_ERROR) +#define LOG4CPLUS_DISABLE_ERROR +#endif +#if defined(LOG4CPLUS_DISABLE_ERROR) && !defined(LOG4CPLUS_DISABLE_WARN) +#define LOG4CPLUS_DISABLE_WARN +#endif +#if defined(LOG4CPLUS_DISABLE_WARN) && !defined(LOG4CPLUS_DISABLE_INFO) +#define LOG4CPLUS_DISABLE_INFO +#endif +#if defined(LOG4CPLUS_DISABLE_INFO) && !defined(LOG4CPLUS_DISABLE_DEBUG) +#define LOG4CPLUS_DISABLE_DEBUG +#endif +#if defined(LOG4CPLUS_DISABLE_DEBUG) && !defined(LOG4CPLUS_DISABLE_TRACE) +#define LOG4CPLUS_DISABLE_TRACE +#endif + + +namespace log4cplus +{ + +namespace detail +{ + + +inline +Logger +macros_get_logger (Logger const & logger) +{ + return logger; +} + + +inline +Logger const & +macros_get_logger (Logger & logger) +{ + return logger; +} + + +#if defined (LOG4CPLUS_HAVE_RVALUE_REFS) +inline +Logger +macros_get_logger (Logger && logger) +{ + return std::move (logger); +} + +#endif + + +inline +Logger +macros_get_logger (tstring const & logger) +{ + return Logger::getInstance (logger); +} + + +inline +Logger +macros_get_logger (tchar const * logger) +{ + return Logger::getInstance (logger); +} + + +LOG4CPLUS_EXPORT void clear_tostringstream (tostringstream &); + + +LOG4CPLUS_EXPORT log4cplus::tostringstream & get_macro_body_oss (); +LOG4CPLUS_EXPORT log4cplus::helpers::snprintf_buf & get_macro_body_snprintf_buf (); +LOG4CPLUS_EXPORT void macro_forced_log (log4cplus::Logger const &, + log4cplus::LogLevel, log4cplus::tstring const &, char const *, int, + char const *); + + +} // namespace detail + +} // namespace log4cplus + + +#undef LOG4CPLUS_MACRO_FUNCTION +#define LOG4CPLUS_MACRO_FUNCTION() 0 +#if ! defined (LOG4CPLUS_DISABLE_FUNCTION_MACRO) +# if defined (LOG4CPLUS_HAVE_FUNCSIG_MACRO) +# undef LOG4CPLUS_MACRO_FUNCTION +# define LOG4CPLUS_MACRO_FUNCTION() __FUNCSIG__ +# elif defined (LOG4CPLUS_HAVE_PRETTY_FUNCTION_MACRO) +# undef LOG4CPLUS_MACRO_FUNCTION +# define LOG4CPLUS_MACRO_FUNCTION() __PRETTY_FUNCTION__ +# elif defined (LOG4CPLUS_HAVE_FUNCTION_MACRO) +# undef LOG4CPLUS_MACRO_FUNCTION +# define LOG4CPLUS_MACRO_FUNCTION() __FUNCTION__ +# elif defined (LOG4CPLUS_HAVE_FUNC_SYMBOL) +# undef LOG4CPLUS_MACRO_FUNCTION +# define LOG4CPLUS_MACRO_FUNCTION() __func__ +# endif +#endif + + +// Make TRACE and DEBUG log level unlikely and INFO, WARN, ERROR and +// FATAL log level likely. +#define LOG4CPLUS_MACRO_TRACE_LOG_LEVEL(pred) \ + LOG4CPLUS_UNLIKELY (pred) +#define LOG4CPLUS_MACRO_DEBUG_LOG_LEVEL(pred) \ + LOG4CPLUS_UNLIKELY (pred) +#define LOG4CPLUS_MACRO_INFO_LOG_LEVEL(pred) \ + LOG4CPLUS_LIKELY (pred) +#define LOG4CPLUS_MACRO_WARN_LOG_LEVEL(pred) \ + LOG4CPLUS_LIKELY (pred) +#define LOG4CPLUS_MACRO_ERROR_LOG_LEVEL(pred) \ + LOG4CPLUS_LIKELY (pred) +#define LOG4CPLUS_MACRO_FATAL_LOG_LEVEL(pred) \ + LOG4CPLUS_LIKELY (pred) + + +//! Dispatch to LOG4CPLUS_MACRO_LOGLEVEL_* depending on log level. +#define LOG4CPLUS_MACRO_LOGLEVEL_PRED(pred, logLevel) \ + LOG4CPLUS_MACRO_ ## logLevel (pred) + + +// Either use temporary instances of ostringstream +// and snprintf_buf, or use thread-local instances. +#if defined (LOG4CPLUS_MACRO_DISABLE_TLS) +# define LOG4CPLUS_MACRO_INSTANTIATE_OSTRINGSTREAM(var) \ + log4cplus::tostringstream var + +# define LOG4CPLUS_MACRO_INSTANTIATE_SNPRINTF_BUF(var) \ + log4cplus::helpers::snprintf_buf var + +#else +# define LOG4CPLUS_MACRO_INSTANTIATE_OSTRINGSTREAM(var) \ + log4cplus::tostringstream & var \ + = log4cplus::detail::get_macro_body_oss () + +# define LOG4CPLUS_MACRO_INSTANTIATE_SNPRINTF_BUF(var) \ + log4cplus::helpers::snprintf_buf & var \ + = log4cplus::detail::get_macro_body_snprintf_buf () + +#endif + + +#define LOG4CPLUS_MACRO_BODY(logger, logEvent, logLevel) \ + LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \ + do { \ + log4cplus::Logger const & _l \ + = log4cplus::detail::macros_get_logger (logger); \ + if (LOG4CPLUS_MACRO_LOGLEVEL_PRED ( \ + _l.isEnabledFor (log4cplus::logLevel), logLevel)) { \ + LOG4CPLUS_MACRO_INSTANTIATE_OSTRINGSTREAM (_log4cplus_buf); \ + _log4cplus_buf << logEvent; \ + log4cplus::detail::macro_forced_log (_l, \ + log4cplus::logLevel, _log4cplus_buf.str(), \ + __FILE__, __LINE__, LOG4CPLUS_MACRO_FUNCTION ()); \ + } \ + } while (0) \ + LOG4CPLUS_RESTORE_DOWHILE_WARNING() + + +#define LOG4CPLUS_MACRO_STR_BODY(logger, logEvent, logLevel) \ + LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \ + do { \ + log4cplus::Logger const & _l \ + = log4cplus::detail::macros_get_logger (logger); \ + if (LOG4CPLUS_MACRO_LOGLEVEL_PRED ( \ + _l.isEnabledFor (log4cplus::logLevel), logLevel)) { \ + log4cplus::detail::macro_forced_log (_l, \ + log4cplus::logLevel, logEvent, \ + __FILE__, __LINE__, LOG4CPLUS_MACRO_FUNCTION ()); \ + } \ + } while(0) \ + LOG4CPLUS_RESTORE_DOWHILE_WARNING() + +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_MACRO_FMT_BODY(logger, logLevel, logFmt, ...) \ + LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \ + do { \ + log4cplus::Logger const & _l \ + = log4cplus::detail::macros_get_logger (logger); \ + if (LOG4CPLUS_MACRO_LOGLEVEL_PRED ( \ + _l.isEnabledFor (log4cplus::logLevel), logLevel)) { \ + LOG4CPLUS_MACRO_INSTANTIATE_SNPRINTF_BUF (_snpbuf); \ + log4cplus::tchar const * _logEvent \ + = _snpbuf.print (logFmt, __VA_ARGS__); \ + log4cplus::detail::macro_forced_log (_l, \ + log4cplus::logLevel, _logEvent, \ + __FILE__, __LINE__, LOG4CPLUS_MACRO_FUNCTION ()); \ + } \ + } while(0) \ + LOG4CPLUS_RESTORE_DOWHILE_WARNING() + +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_MACRO_FMT_BODY(logger, logLevel, logFmt, logArgs...) \ + LOG4CPLUS_SUPPRESS_DOWHILE_WARNING() \ + do { \ + log4cplus::Logger const & _l \ + = log4cplus::detail::macros_get_logger (logger); \ + if (LOG4CPLUS_MACRO_LOGLEVEL_PRED ( \ + _l.isEnabledFor (log4cplus::logLevel), logLevel)) { \ + LOG4CPLUS_MACRO_INSTANTIATE_SNPRINTF_BUF (_snpbuf); \ + log4cplus::tchar const * _logEvent \ + = _snpbuf.print (logFmt, logArgs); \ + log4cplus::detail::macro_forced_log (_l, \ + log4cplus::logLevel, _logEvent, \ + __FILE__, __LINE__, LOG4CPLUS_MACRO_FUNCTION ()); \ + } \ + } while(0) \ + LOG4CPLUS_RESTORE_DOWHILE_WARNING() + +#endif + + +/** + * @def LOG4CPLUS_TRACE(logger, logEvent) This macro creates a + * TraceLogger to log a TRACE_LOG_LEVEL message to logger + * upon entry and exiting of a method. + * logEvent will be streamed into an ostream. + */ +#if !defined(LOG4CPLUS_DISABLE_TRACE) +#define LOG4CPLUS_TRACE_METHOD(logger, logEvent) \ + log4cplus::TraceLogger _log4cplus_trace_logger(logger, logEvent, \ + __FILE__, __LINE__); +#define LOG4CPLUS_TRACE(logger, logEvent) \ + LOG4CPLUS_MACRO_BODY (logger, logEvent, TRACE_LOG_LEVEL) +#define LOG4CPLUS_TRACE_STR(logger, logEvent) \ + LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, TRACE_LOG_LEVEL) + +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_TRACE_FMT(logger, logFmt, ...) \ + LOG4CPLUS_MACRO_FMT_BODY (logger, TRACE_LOG_LEVEL, logFmt, __VA_ARGS__) +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_TRACE_FMT(logger, logFmt, logArgs...) \ + LOG4CPLUS_MACRO_FMT_BODY(logger, TRACE_LOG_LEVEL, logFmt, logArgs) +#endif + +#else +#define LOG4CPLUS_TRACE_METHOD(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#define LOG4CPLUS_TRACE(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#define LOG4CPLUS_TRACE_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_TRACE_FMT(logger, logFmt, ...) LOG4CPLUS_DOWHILE_NOTHING() +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_TRACE_FMT(logger, logFmt, logArgs...) LOG4CPLUS_DOWHILE_NOTHING() +#endif + +#endif + +/** + * @def LOG4CPLUS_DEBUG(logger, logEvent) This macro is used to log a + * DEBUG_LOG_LEVEL message to logger. + * logEvent will be streamed into an ostream. + */ +#if !defined(LOG4CPLUS_DISABLE_DEBUG) +#define LOG4CPLUS_DEBUG(logger, logEvent) \ + LOG4CPLUS_MACRO_BODY (logger, logEvent, DEBUG_LOG_LEVEL) +#define LOG4CPLUS_DEBUG_STR(logger, logEvent) \ + LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, DEBUG_LOG_LEVEL) + +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_DEBUG_FMT(logger, logFmt, ...) \ + LOG4CPLUS_MACRO_FMT_BODY (logger, DEBUG_LOG_LEVEL, logFmt, __VA_ARGS__) +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_DEBUG_FMT(logger, logFmt, logArgs...) \ + LOG4CPLUS_MACRO_FMT_BODY(logger, DEBUG_LOG_LEVEL, logFmt, logArgs) +#endif + +#else +#define LOG4CPLUS_DEBUG(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#define LOG4CPLUS_DEBUG_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_DEBUG_FMT(logger, logFmt, ...) LOG4CPLUS_DOWHILE_NOTHING() +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_DEBUG_FMT(logger, logFmt, logArgs...) LOG4CPLUS_DOWHILE_NOTHING() +#endif + +#endif + +/** + * @def LOG4CPLUS_INFO(logger, logEvent) This macro is used to log a + * INFO_LOG_LEVEL message to logger. + * logEvent will be streamed into an ostream. + */ +#if !defined(LOG4CPLUS_DISABLE_INFO) +#define LOG4CPLUS_INFO(logger, logEvent) \ + LOG4CPLUS_MACRO_BODY (logger, logEvent, INFO_LOG_LEVEL) +#define LOG4CPLUS_INFO_STR(logger, logEvent) \ + LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, INFO_LOG_LEVEL) + +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_INFO_FMT(logger, logFmt, ...) \ + LOG4CPLUS_MACRO_FMT_BODY (logger, INFO_LOG_LEVEL, logFmt, __VA_ARGS__) +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_INFO_FMT(logger, logFmt, logArgs...) \ + LOG4CPLUS_MACRO_FMT_BODY(logger, INFO_LOG_LEVEL, logFmt, logArgs) +#endif + +#else +#define LOG4CPLUS_INFO(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#define LOG4CPLUS_INFO_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_INFO_FMT(logger, logFmt, ...) LOG4CPLUS_DOWHILE_NOTHING() +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_INFO_FMT(logger, logFmt, logArgs...) LOG4CPLUS_DOWHILE_NOTHING() +#endif + +#endif + +/** + * @def LOG4CPLUS_WARN(logger, logEvent) This macro is used to log a + * WARN_LOG_LEVEL message to logger. + * logEvent will be streamed into an ostream. + */ +#if !defined(LOG4CPLUS_DISABLE_WARN) +#define LOG4CPLUS_WARN(logger, logEvent) \ + LOG4CPLUS_MACRO_BODY (logger, logEvent, WARN_LOG_LEVEL) +#define LOG4CPLUS_WARN_STR(logger, logEvent) \ + LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, WARN_LOG_LEVEL) + +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_WARN_FMT(logger, logFmt, ...) \ + LOG4CPLUS_MACRO_FMT_BODY (logger, WARN_LOG_LEVEL, logFmt, __VA_ARGS__) +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_WARN_FMT(logger, logFmt, logArgs...) \ + LOG4CPLUS_MACRO_FMT_BODY(logger, WARN_LOG_LEVEL, logFmt, logArgs) +#endif + +#else +#define LOG4CPLUS_WARN(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#define LOG4CPLUS_WARN_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_WARN_FMT(logger, logFmt, ...) LOG4CPLUS_DOWHILE_NOTHING() +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_WARN_FMT(logger, logFmt, logArgs...) LOG4CPLUS_DOWHILE_NOTHING() +#endif + +#endif + +/** + * @def LOG4CPLUS_ERROR(logger, logEvent) This macro is used to log a + * ERROR_LOG_LEVEL message to logger. + * logEvent will be streamed into an ostream. + */ +#if !defined(LOG4CPLUS_DISABLE_ERROR) +#define LOG4CPLUS_ERROR(logger, logEvent) \ + LOG4CPLUS_MACRO_BODY (logger, logEvent, ERROR_LOG_LEVEL) +#define LOG4CPLUS_ERROR_STR(logger, logEvent) \ + LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, ERROR_LOG_LEVEL) + +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_ERROR_FMT(logger, logFmt, ...) \ + LOG4CPLUS_MACRO_FMT_BODY (logger, ERROR_LOG_LEVEL, logFmt, __VA_ARGS__) +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_ERROR_FMT(logger, logFmt, logArgs...) \ + LOG4CPLUS_MACRO_FMT_BODY(logger, ERROR_LOG_LEVEL, logFmt, logArgs) +#endif + +#else +#define LOG4CPLUS_ERROR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#define LOG4CPLUS_ERROR_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_ERROR_FMT(logger, logFmt, ...) LOG4CPLUS_DOWHILE_NOTHING() +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_ERROR_FMT(logger, logFmt, logArgs...) LOG4CPLUS_DOWHILE_NOTHING() +#endif + +#endif + +/** + * @def LOG4CPLUS_FATAL(logger, logEvent) This macro is used to log a + * FATAL_LOG_LEVEL message to logger. + * logEvent will be streamed into an ostream. + */ +#if !defined(LOG4CPLUS_DISABLE_FATAL) +#define LOG4CPLUS_FATAL(logger, logEvent) \ + LOG4CPLUS_MACRO_BODY (logger, logEvent, FATAL_LOG_LEVEL) +#define LOG4CPLUS_FATAL_STR(logger, logEvent) \ + LOG4CPLUS_MACRO_STR_BODY (logger, logEvent, FATAL_LOG_LEVEL) + +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_FATAL_FMT(logger, logFmt, ...) \ + LOG4CPLUS_MACRO_FMT_BODY (logger, FATAL_LOG_LEVEL, logFmt, __VA_ARGS__) +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_FATAL_FMT(logger, logFmt, logArgs...) \ + LOG4CPLUS_MACRO_FMT_BODY(logger, FATAL_LOG_LEVEL, logFmt, logArgs) +#endif + +#else +#define LOG4CPLUS_FATAL(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#define LOG4CPLUS_FATAL_STR(logger, logEvent) LOG4CPLUS_DOWHILE_NOTHING() +#if defined (LOG4CPLUS_HAVE_C99_VARIADIC_MACROS) +#define LOG4CPLUS_FATAL_FMT(logger, logFmt, ...) LOG4CPLUS_DOWHILE_NOTHING() +#elif defined (LOG4CPLUS_HAVE_GNU_VARIADIC_MACROS) +#define LOG4CPLUS_FATAL_FMT(logger, logFmt, logArgs...) LOG4CPLUS_DOWHILE_NOTHING() +#endif + +#endif + +#endif /* LOG4CPLUS_LOGGING_MACROS_HEADER_ */ diff --git a/src/nar/resources/noarch/include/log4cplus/loglevel.h b/src/nar/resources/noarch/include/log4cplus/loglevel.h new file mode 100644 index 0000000..d7e0db2 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/loglevel.h @@ -0,0 +1,209 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: loglevel.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file + * This header defines the LogLevel type. + */ + +#ifndef LOG4CPLUS_LOGLEVEL_HEADER_ +#define LOG4CPLUS_LOGLEVEL_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + + +namespace log4cplus { + + /** + * \typedef int LogLevel + * Defines the minimum set of priorities recognized by the system, + * that is {@link #FATAL_LOG_LEVEL}, {@link #ERROR_LOG_LEVEL}, {@link + * #WARN_LOG_LEVEL}, {@link #INFO_LOG_LEVEL}, {@link #DEBUG_LOG_LEVEL}, + * and {@link #TRACE_LOG_LEVEL}. + */ + typedef int LogLevel; + + /** \var const LogLevel OFF_LOG_LEVEL + * The OFF_LOG_LEVEL LogLevel is used during configuration to + * turn off logging. */ + const LogLevel OFF_LOG_LEVEL = 60000; + + /** \var const LogLevel FATAL_LOG_LEVEL + * The FATAL_LOG_LEVEL LogLevel designates very severe error + * events that will presumably lead the application to abort. */ + const LogLevel FATAL_LOG_LEVEL = 50000; + + /** \var const LogLevel ERROR_LOG_LEVEL + * The ERROR_LOG_LEVEL LogLevel designates error events that + * might still allow the application to continue running. */ + const LogLevel ERROR_LOG_LEVEL = 40000; + + /** \var const LogLevel WARN_LOG_LEVEL + * The WARN_LOG_LEVEL LogLevel designates potentially harmful + * situations. */ + const LogLevel WARN_LOG_LEVEL = 30000; + + /** \var const LogLevel INFO_LOG_LEVEL + * The INFO_LOG_LEVEL LogLevel designates informational + * messages that highlight the progress of the application at + * coarse-grained level. */ + const LogLevel INFO_LOG_LEVEL = 20000; + + /** \var const LogLevel DEBUG_LOG_LEVEL + * The DEBUG_LOG_LEVEL LogLevel designates fine-grained + * informational events that are most useful to debug an application. */ + const LogLevel DEBUG_LOG_LEVEL = 10000; + + /** \var const LogLevel TRACE_LOG_LEVEL + * The TRACE_LOG_LEVEL LogLevel is used to "trace" entry + * and exiting of methods. */ + const LogLevel TRACE_LOG_LEVEL = 0; + + /** \var const LogLevel ALL_LOG_LEVEL + * The ALL_LOG_LEVEL LogLevel is used during configuration to + * turn on all logging. */ + const LogLevel ALL_LOG_LEVEL = TRACE_LOG_LEVEL; + + /** \var const LogLevel NOT_SET_LOG_LEVEL + * The NOT_SET_LOG_LEVEL LogLevel is used to indicated that + * no particular LogLevel is desired and that the default should be used. + */ + const LogLevel NOT_SET_LOG_LEVEL = -1; + + + /** + * This method type defined the signature of methods that convert LogLevels + * into strings. + * + * Note: Must return an empty tstring for unrecognized values. + */ + typedef log4cplus::tstring const & (*LogLevelToStringMethod)(LogLevel); + + //! This function type is for log4cplus 1.0.x callbacks. + typedef log4cplus::tstring (*LogLevelToStringMethod_1_0) (LogLevel); + + + /** + * This method type defined the signature of methods that convert strings + * into LogLevels. + * + * Note: Must return NOT_SET_LOG_LEVEL for unrecognized values. + */ + typedef LogLevel (*StringToLogLevelMethod)(const log4cplus::tstring&); + + + + /** + * This class is used to "manage" LogLevel definitions. This class is also + * how "derived" LogLevels are created. Here are the steps to creating a + * "derived" LogLevel: + *
    + *
  1. Create a LogLevel constant (greater than 0)
  2. + *
  3. Define a string to represent that constant
  4. + *
  5. Implement a LogLevelToStringMethod method.
  6. + *
  7. Implement a StringToLogLevelMethod method.
  8. + *
  9. create a "static initializer" that registers those 2 methods + * with the LogLevelManager singleton.
  10. + *
+ */ + class LOG4CPLUS_EXPORT LogLevelManager { + public: + LogLevelManager(); + ~LogLevelManager(); + + /** + * This method is called by all Layout classes to convert a LogLevel + * into a string. + * + * Note: It traverses the list of LogLevelToStringMethod + * to do this, so all "derived" LogLevels are recognized as well. + */ + log4cplus::tstring const & toString(LogLevel ll) const; + + /** + * This method is called by all classes internally to log4cplus to + * convert a string into a LogLevel. + * + * Note: It traverses the list of StringToLogLevelMethod + * to do this, so all "derived" LogLevels are recognized as well. + */ + LogLevel fromString(const log4cplus::tstring& s) const; + + /** + * When creating a "derived" LogLevel, a LogLevelToStringMethod + * should be defined and registered with the LogLevelManager by calling + * this method. + * + * @see pushFromStringMethod + */ + void pushToStringMethod(LogLevelToStringMethod newToString); + + //! For compatibility with log4cplus 1.0.x. + void pushToStringMethod(LogLevelToStringMethod_1_0 newToString); + + /** + * When creating a "derived" LogLevel, a StringToLogLevelMethod + * should be defined and registered with the LogLevelManager by calling + * this method. + * + * @see pushToStringMethod + */ + void pushFromStringMethod(StringToLogLevelMethod newFromString); + + private: + // Data + struct LogLevelToStringMethodRec + { + union + { + LogLevelToStringMethod func; + LogLevelToStringMethod_1_0 func_1_0; + }; + bool use_1_0; + }; + + typedef std::vector LogLevelToStringMethodList; + LogLevelToStringMethodList toStringMethods; + + typedef std::vector StringToLogLevelMethodList; + StringToLogLevelMethodList fromStringMethods; + + // Disable Copy + LogLevelManager(const LogLevelManager&); + LogLevelManager& operator=(const LogLevelManager&); + }; + + /** + * Returns the singleton LogLevelManager. + */ + LOG4CPLUS_EXPORT LogLevelManager& getLogLevelManager(); + +} + + +#endif // LOG4CPLUS_LOGLEVEL_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/mdc.h b/src/nar/resources/noarch/include/log4cplus/mdc.h new file mode 100644 index 0000000..ff23774 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/mdc.h @@ -0,0 +1,77 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_MDC_H_HEADER +#define LOG4CPLUS_MDC_H_HEADER + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +#include + + +namespace log4cplus +{ + + +typedef std::map MappedDiagnosticContextMap; + + +class LOG4CPLUS_EXPORT MDC +{ +public: + /** + * Clear any nested diagnostic information if any. This method is + * useful in cases where the same thread can be potentially used + * over and over in different unrelated contexts. + */ + void clear(); + + void put (tstring const & key, tstring const & value); + bool get (tstring * value, tstring const & key) const; + void remove (tstring const & key); + + MappedDiagnosticContextMap const & getContext () const; + + // Public ctor and dtor but only to be used by internal::DefaultContext. + MDC (); + virtual ~MDC (); + +private: + LOG4CPLUS_PRIVATE static MappedDiagnosticContextMap * getPtr (); +}; + + +LOG4CPLUS_EXPORT MDC & getMDC (); + + +} // namespace log4cplus + + +#endif // LOG4CPLUS_MDC_H_HEADER diff --git a/src/nar/resources/noarch/include/log4cplus/ndc.h b/src/nar/resources/noarch/include/log4cplus/ndc.h new file mode 100644 index 0000000..26e1b59 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/ndc.h @@ -0,0 +1,332 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: ndc.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file + * This header defined the NDC class. + */ + +#ifndef _LO4CPLUS_NDC_HEADER_ +#define _LO4CPLUS_NDC_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +#include +#include + + +namespace log4cplus { + // Forward declarations + struct DiagnosticContext; + typedef std::deque DiagnosticContextStack; + + /** + * The NDC class implements nested diagnostic contexts as + * defined by Neil Harrison in the article "Patterns for Logging + * Diagnostic Messages" part of the book "Pattern Languages of + * Program Design 3" edited by Martin et al. + * + * A Nested Diagnostic Context, or NDC in short, is an instrument + * to distinguish interleaved log output from different sources. Log + * output is typically interleaved when a server handles multiple + * clients near-simultaneously. + * + * Interleaved log output can still be meaningful if each log entry + * from different contexts had a distinctive stamp. This is where NDCs + * come into play. + * + * Note that NDCs are managed on a per thread + * basis. NDC operations such as {@link #push}, {@link + * #pop}, {@link #clear}, {@link #getDepth} and {@link #setMaxDepth} + * affect the NDC of the current thread only. NDCs of other + * threads remain unaffected. + * + * For example, a server can build a per client request NDC + * consisting the clients host name and other information contained in + * the the request. Cookies are another source of distinctive + * information. To build an NDC one uses the {@link #push} + * operation. Simply put, + * + *
    + *
  • Contexts can be nested. + * + *
  • When entering a context, call getNDC().push(). As a + * side effect, if there is no nested diagnostic context for the + * current thread, this method will create it. + * + *
  • When leaving a context, call getNDC().pop(). + * + *
  • When exiting a thread make sure to call {@link #remove + * NDC.remove()}. + *
+ * + * There is no penalty for forgetting to match each + * push operation with a corresponding pop, + * except the obvious mismatch between the real application context + * and the context set in the NDC. Use of the {@link NDCContextCreator} + * class can automate this process and make your code exception-safe. + * + * If configured to do so, {@link log4cplus::PatternLayout} and + * {@link log4cplus::TTCCLayout} instances automatically retrieve + * the nested diagnostic context for the current thread without + * any user intervention. Hence, even if a server is serving + * multiple clients simultaneously, the logs emanating from the + * same code (belonging to the same logger) can still be + * distinguished because each client request will have a different + * NDC tag. + * + * Heavy duty systems should call the {@link #remove} method when + * leaving the run method of a thread. This ensures that the memory + * used by the thread can be freed. + * + * A thread may inherit the nested diagnostic context of another + * (possibly parent) thread using the {@link #inherit inherit} + * method. A thread may obtain a copy of its NDC with the {@link + * #cloneStack cloneStack} method and pass the reference to any other + * thread, in particular to a child. + */ + class LOG4CPLUS_EXPORT NDC + { + public: + /** + * Clear any nested diagnostic information if any. This method is + * useful in cases where the same thread can be potentially used + * over and over in different unrelated contexts. + * + * This method is equivalent to calling the {@link #setMaxDepth} + * method with a zero maxDepth argument. + */ + void clear(); + + /** + * Clone the diagnostic context for the current thread. + * + * Internally a diagnostic context is represented as a stack. A + * given thread can supply the stack (i.e. diagnostic context) to a + * child thread so that the child can inherit the parent thread's + * diagnostic context. + * + * The child thread uses the {@link #inherit inherit} method to + * inherit the parent's diagnostic context. + * + * @return Stack A clone of the current thread's diagnostic context. + */ + DiagnosticContextStack cloneStack() const; + + /** + * Inherit the diagnostic context of another thread. + * + * The parent thread can obtain a reference to its diagnostic + * context using the {@link #cloneStack} method. It should + * communicate this information to its child so that it may inherit + * the parent's diagnostic context. + * + * The parent's diagnostic context is cloned before being + * inherited. In other words, once inherited, the two diagnostic + * contexts can be managed independently. + * + * @param stack The diagnostic context of the parent thread. + */ + void inherit(const DiagnosticContextStack& stack); + + /** + * Used when printing the diagnostic context. + */ + log4cplus::tstring const & get() const; + + /** + * Get the current nesting depth of this diagnostic context. + * + * @see #setMaxDepth + */ + std::size_t getDepth() const; + + /** + * Clients should call this method before leaving a diagnostic + * context. + * + * The returned value is the value that was pushed last. If no + * context is available, then the empty string "" is + * returned. If each call to push() is paired with a call to + * pop() (even in presence of thrown exceptions), the last + * pop() call frees the memory used by NDC for this + * thread. Otherwise, remove() must be called at the end of + * the thread to free the memory used by NDC for the thread. + * + * @return String The innermost diagnostic context. + * + * @see NDCContextCreator, remove(), push() + */ + log4cplus::tstring pop(); + + /** + * Same as pop() but without the return value. + */ + void pop_void (); + + /** + * Looks at the last diagnostic context at the top of this NDC + * without removing it. + * + * The returned value is the value that was pushed last. If no + * context is available, then the empty string "" is returned. + * + * @return String The innermost diagnostic context. + */ + log4cplus::tstring const & peek() const; + + /** + * Push new diagnostic context information for the current thread. + * + * The contents of the message parameter is + * determined solely by the client. Each call to push() should + * be paired with a call to pop(). + * + * @param message The new diagnostic context information. + * + * @see NDCContextCreator, pop(), remove() + */ + void push(const log4cplus::tstring& message); + void push(tchar const * message); + + /** + * Remove the diagnostic context for this thread. + * + * Each thread that created a diagnostic context by calling + * push() should call this method before exiting. Otherwise, + * the memory used by the thread cannot be reclaimed. It is + * possible to omit this call if and only if each push() call + * is always paired with a pop() call (even in presence of + * thrown exceptions). Then the memory used by NDC will be + * returned by the last pop() call and a call to remove() will + * be no-op. + */ + void remove(); + + /** + * Set maximum depth of this diagnostic context. If the current + * depth is smaller or equal to maxDepth, then no + * action is taken. + * + * This method is a convenient alternative to multiple {@link + * #pop} calls. Moreover, it is often the case that at the end of + * complex call sequences, the depth of the NDC is + * unpredictable. The setMaxDepth method circumvents + * this problem. + * + * For example, the combination + *
+         *    void foo() {
+         *       std::size_t depth = NDC.getDepth();
+         *
+         *       ... complex sequence of calls
+         *
+         *       NDC.setMaxDepth(depth);
+         *    }
+         * 
+ * + * ensures that between the entry and exit of foo the depth of the + * diagnostic stack is conserved. + * + * Note: Use of the {@link NDCContextCreator} class will solve + * this particular problem. + * + * @see #getDepth + */ + void setMaxDepth(std::size_t maxDepth); + + // Public ctor but only to be used by internal::DefaultContext. + NDC(); + + // Dtor + virtual ~NDC(); + + private: + // Methods + LOG4CPLUS_PRIVATE static DiagnosticContextStack* getPtr(); + + template + LOG4CPLUS_PRIVATE + void push_worker (StringType const &); + + // Disallow construction (and copying) except by getNDC() + NDC(const NDC&); + NDC& operator=(const NDC&); + }; + + + /** + * Return a reference to the singleton object. + */ + LOG4CPLUS_EXPORT NDC& getNDC(); + + + /** + * This is the internal object that is stored on the NDC stack. + */ + struct LOG4CPLUS_EXPORT DiagnosticContext + { + // Ctors + DiagnosticContext(const log4cplus::tstring& message, + DiagnosticContext const * parent); + DiagnosticContext(tchar const * message, + DiagnosticContext const * parent); + DiagnosticContext(const log4cplus::tstring& message); + DiagnosticContext(tchar const * message); + DiagnosticContext(DiagnosticContext const &); + DiagnosticContext & operator = (DiagnosticContext const &); + +#if defined (LOG4CPLUS_HAVE_RVALUE_REFS) + DiagnosticContext(DiagnosticContext &&); + DiagnosticContext & operator = (DiagnosticContext &&); +#endif + + void swap (DiagnosticContext &); + + // Data + log4cplus::tstring message; /*!< The message at this context level. */ + log4cplus::tstring fullMessage; /*!< The entire message stack. */ + }; + + + /** + * This class ensures that a {@link NDC#push} call is always matched with + * a {@link NDC#pop} call even in the face of exceptions. + */ + class LOG4CPLUS_EXPORT NDCContextCreator { + public: + /** Pushes msg onto the NDC stack. */ + NDCContextCreator(const log4cplus::tstring& msg); + NDCContextCreator(tchar const * msg); + + /** Pops the NDC stack. */ + ~NDCContextCreator(); + }; + +} // end namespace log4cplus + + +#endif // _LO4CPLUS_NDC_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/nteventlogappender.h b/src/nar/resources/noarch/include/log4cplus/nteventlogappender.h new file mode 100644 index 0000000..9ea3a89 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/nteventlogappender.h @@ -0,0 +1,84 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: nteventlogappender.h +// Created: 4/2003 +// Author: Michael CATANZARITI +// +// Copyright 2003-2013 Michael CATANZARITI +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_ +#define LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined (LOG4CPLUS_HAVE_NT_EVENT_LOG) + +#include +#include + + +namespace log4cplus { + + /** + * Appends log events to NT EventLog. + */ + class LOG4CPLUS_EXPORT NTEventLogAppender : public Appender { + public: + // ctors + NTEventLogAppender(const log4cplus::tstring& server, + const log4cplus::tstring& log, + const log4cplus::tstring& source); + NTEventLogAppender(const log4cplus::helpers::Properties & properties); + + // dtor + virtual ~NTEventLogAppender(); + + // public Methods + virtual void close(); + + protected: + virtual void append(const spi::InternalLoggingEvent& event); + virtual WORD getEventType(const spi::InternalLoggingEvent& event); + virtual WORD getEventCategory(const spi::InternalLoggingEvent& event); + void init(); + + /* + * Add this source with appropriate configuration keys to the registry. + */ + void addRegistryInfo(); + + // Data + log4cplus::tstring server; + log4cplus::tstring log; + log4cplus::tstring source; + HANDLE hEventLog; + SID* pCurrentUserSID; + + private: + // Disallow copying of instances of this class + NTEventLogAppender(const NTEventLogAppender&); + NTEventLogAppender& operator=(const NTEventLogAppender&); + }; + +} // end namespace log4cplus + +#endif // LOG4CPLUS_HAVE_NT_EVENT_LOG +#endif //LOG4CPLUS_NT_EVENT_LOG_APPENDER_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/nullappender.h b/src/nar/resources/noarch/include/log4cplus/nullappender.h new file mode 100644 index 0000000..15456fc --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/nullappender.h @@ -0,0 +1,65 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: nullappender.h +// Created: 6/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_NULL_APPENDER_HEADER_ +#define LOG4CPLUS_NULL_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + + +namespace log4cplus { + + /** + * Appends log events to a file. + */ + class LOG4CPLUS_EXPORT NullAppender : public Appender { + public: + // Ctors + NullAppender(); + NullAppender(const log4cplus::helpers::Properties&); + + // Dtor + virtual ~NullAppender(); + + // Methods + virtual void close(); + + protected: + virtual void append(const log4cplus::spi::InternalLoggingEvent& event); + + private: + // Disallow copying of instances of this class + NullAppender(const NullAppender&); + NullAppender& operator=(const NullAppender&); + }; + +} // end namespace log4cplus + +#endif // LOG4CPLUS_NULL_APPENDER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/qt4debugappender.h b/src/nar/resources/noarch/include/log4cplus/qt4debugappender.h new file mode 100644 index 0000000..8908a6e --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/qt4debugappender.h @@ -0,0 +1,103 @@ +// -*- C++ -*- +// Module: Log4cplus +// File: qt4debugappender.h +// Created: 5/2012 +// Author: Vaclav Zeman +// +// +// Copyright (C) 2012-2013, Vaclav Zeman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +// + +/** @file */ + +#ifndef LOG4CPLUS_QT4DEBUGAPPENDER_H +#define LOG4CPLUS_QT4DEBUGAPPENDER_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +#if defined (_WIN32) + #if defined (log4cplusqt4debugappender_EXPORTS) \ + || defined (log4cplusqt4debugappenderU_EXPORTS) \ + || defined (DLL_EXPORT) + #undef LOG4CPLUS_QT4DEBUGAPPENDER_BUILD_DLL + #define LOG4CPLUS_QT4DEBUGAPPENDER_BUILD_DLL + #endif + #if defined (LOG4CPLUS_QT4DEBUGAPPENDER_BUILD_DLL) + #if defined (INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER) + #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT __declspec(dllexport) + #else + #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT __declspec(dllimport) + #endif + #else + #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT + #endif +#else + #if defined (INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER) + #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_EXPORT + #else + #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_IMPORT + #endif // defined (INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER) +#endif // !_WIN32 + + +namespace log4cplus +{ + + +class LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT Qt4DebugAppender + : public Appender +{ +public: + Qt4DebugAppender (); + explicit Qt4DebugAppender (helpers::Properties const &); + virtual ~Qt4DebugAppender (); + + virtual void close (); + + static void registerAppender (); + +protected: + virtual void append (spi::InternalLoggingEvent const &); + +private: + Qt4DebugAppender (Qt4DebugAppender const &); + Qt4DebugAppender & operator = (Qt4DebugAppender const &); +}; + + +typedef helpers::SharedObjectPtr Qt4DebugAppenderPtr; + + +} // namespace log4cplus + + +#endif // LOG4CPLUS_QT4DEBUGAPPENDER_H diff --git a/src/nar/resources/noarch/include/log4cplus/socketappender.h b/src/nar/resources/noarch/include/log4cplus/socketappender.h new file mode 100644 index 0000000..a288c51 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/socketappender.h @@ -0,0 +1,170 @@ +// -*- C++ -*- +// Module: LOG4CPLUS +// File: socketappender.h +// Created: 5/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SOCKET_APPENDER_HEADER_ +#define LOG4CPLUS_SOCKET_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include + + +namespace log4cplus +{ + + +#ifndef UNICODE + std::size_t const LOG4CPLUS_MAX_MESSAGE_SIZE = 8*1024; +#else + std::size_t const LOG4CPLUS_MAX_MESSAGE_SIZE = 2*8*1024; +#endif + + + /** + * Sends {@link spi::InternalLoggingEvent} objects to a remote a log server. + * + * The SocketAppender has the following properties: + * + *
    + * + *
  • Remote logging is non-intrusive as far as the log event + * is concerned. In other words, the event will be logged with + * the same time stamp, NDC, location info as if it were logged + * locally by the client. + * + *
  • SocketAppenders do not use a layout. + * + *
  • Remote logging uses the TCP protocol. Consequently, if + * the server is reachable, then log events will eventually arrive + * at the server. + * + *
  • If the remote server is down, the logging requests are + * simply dropped. However, if and when the server comes back up, + * then event transmission is resumed transparently. This + * transparent reconneciton is performed by a connector + * thread which periodically attempts to connect to the server. + * + *
  • Logging events are automatically buffered by the + * native TCP implementation. This means that if the link to server + * is slow but still faster than the rate of (log) event production + * by the client, the client will not be affected by the slow + * network connection. However, if the network connection is slower + * then the rate of event production, then the client can only + * progress at the network rate. In particular, if the network link + * to the the server is down, the client will be blocked. + * + *
  • On the other hand, if the network link is up, but the server + * is down, the client will not be blocked when making log requests + * but the log events will be lost due to server unavailability. + *
+ * + *

Properties

+ *
+ *
host
+ *
Remote host name to connect and send events to.
+ * + *
port
+ *
Port on remote host to send events to.
+ * + *
ServerName
+ *
Host name of event's origin prepended to each event.
+ * + *
+ */ + class LOG4CPLUS_EXPORT SocketAppender : public Appender { + public: + // Ctors + SocketAppender(const log4cplus::tstring& host, unsigned short port, + const log4cplus::tstring& serverName = tstring()); + SocketAppender(const log4cplus::helpers::Properties & properties); + + // Dtor + ~SocketAppender(); + + // Methods + virtual void close(); + + protected: + void openSocket(); + void initConnector (); + virtual void append(const spi::InternalLoggingEvent& event); + + // Data + log4cplus::helpers::Socket socket; + log4cplus::tstring host; + unsigned int port; + log4cplus::tstring serverName; + +#if ! defined (LOG4CPLUS_SINGLE_THREADED) + class LOG4CPLUS_EXPORT ConnectorThread; + friend class ConnectorThread; + + class LOG4CPLUS_EXPORT ConnectorThread + : public thread::AbstractThread + { + public: + ConnectorThread (SocketAppender &); + virtual ~ConnectorThread (); + + virtual void run(); + + void terminate (); + void trigger (); + + protected: + SocketAppender & sa; + thread::ManualResetEvent trigger_ev; + bool exit_flag; + }; + + volatile bool connected; + helpers::SharedObjectPtr connector; +#endif + + private: + // Disallow copying of instances of this class + SocketAppender(const SocketAppender&); + SocketAppender& operator=(const SocketAppender&); + }; + + namespace helpers { + LOG4CPLUS_EXPORT + void convertToBuffer (SocketBuffer & buffer, + const log4cplus::spi::InternalLoggingEvent& event, + const log4cplus::tstring& serverName); + + LOG4CPLUS_EXPORT + log4cplus::spi::InternalLoggingEvent readFromBuffer(SocketBuffer& buffer); + } // end namespace helpers + +} // end namespace log4cplus + +#endif // LOG4CPLUS_SOCKET_APPENDER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/spi/appenderattachable.h b/src/nar/resources/noarch/include/log4cplus/spi/appenderattachable.h new file mode 100644 index 0000000..986bf9b --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/appenderattachable.h @@ -0,0 +1,90 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: appenderattachable.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_ +#define LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include + +namespace log4cplus { + // Forward Declarations + typedef helpers::SharedObjectPtr SharedAppenderPtr; + typedef std::vector SharedAppenderPtrList; + + namespace spi { + + /** + * This Interface is for attaching Appenders to objects. + */ + class LOG4CPLUS_EXPORT AppenderAttachable { + public: + // Methods + /** + * Add an appender. + */ + virtual void addAppender(SharedAppenderPtr newAppender) = 0; + + /** + * Get all previously added appenders as an Enumeration. + */ + virtual SharedAppenderPtrList getAllAppenders() = 0; + + /** + * Get an appender by name. + */ + virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name) = 0; + + /** + * Remove all previously added appenders. + */ + virtual void removeAllAppenders() = 0; + + /** + * Remove the appender passed as parameter from the list of appenders. + */ + virtual void removeAppender(SharedAppenderPtr appender) = 0; + + /** + * Remove the appender with the name passed as parameter from the + * list of appenders. + */ + virtual void removeAppender(const log4cplus::tstring& name) = 0; + + // Dtor + virtual ~AppenderAttachable() = 0; + }; + + } // end namespace spi +} // end namespace log4cplus + +#endif // LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/spi/factory.h b/src/nar/resources/noarch/include/log4cplus/spi/factory.h new file mode 100644 index 0000000..709edf5 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/factory.h @@ -0,0 +1,273 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: factory.h +// Created: 2/2002 +// Author: Tad E. Smith +// +// +// Copyright 2002-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SPI_FACTORY_HEADER_ +#define LOG4CPLUS_SPI_FACTORY_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace log4cplus { + namespace spi { + + /** + * This is the base class for all factories. + */ + class LOG4CPLUS_EXPORT BaseFactory { + public: + virtual ~BaseFactory() = 0; + + /** + * Returns the typename of the objects this factory creates. + */ + virtual log4cplus::tstring const & getTypeName() const = 0; + }; + + + /** + * This abstract class defines the "Factory" interface to create "Appender" + * objects. + */ + class LOG4CPLUS_EXPORT AppenderFactory : public BaseFactory { + public: + typedef Appender ProductType; + typedef SharedAppenderPtr ProductPtr; + + AppenderFactory(); + virtual ~AppenderFactory() = 0; + + /** + * Create an "Appender" object. + */ + virtual SharedAppenderPtr createObject(const log4cplus::helpers::Properties& props) = 0; + }; + + + + /** + * This abstract class defines the "Factory" interface to create "Layout" + * objects. + */ + class LOG4CPLUS_EXPORT LayoutFactory : public BaseFactory { + public: + typedef Layout ProductType; + typedef std::auto_ptr ProductPtr; + + LayoutFactory(); + virtual ~LayoutFactory() = 0; + + /** + * Create a "Layout" object. + */ + virtual std::auto_ptr createObject(const log4cplus::helpers::Properties& props) = 0; + }; + + + + /** + * This abstract class defines the "Factory" interface to create "Appender" + * objects. + */ + class LOG4CPLUS_EXPORT FilterFactory : public BaseFactory { + public: + typedef Filter ProductType; + typedef FilterPtr ProductPtr; + + FilterFactory(); + virtual ~FilterFactory() = 0; + + /** + * Create a "Filter" object. + */ + virtual FilterPtr createObject(const log4cplus::helpers::Properties& props) = 0; + }; + + + /** + * This abstract class defines the "Factory" interface to + * create std::locale instances. + */ + class LOG4CPLUS_EXPORT LocaleFactory + : public BaseFactory + { + public: + typedef std::locale ProductType; + typedef std::locale ProductPtr; + + LocaleFactory(); + virtual ~LocaleFactory() = 0; + + //! \returns std::locale instance + virtual ProductPtr createObject ( + const log4cplus::helpers::Properties & props) = 0; + }; + + + /** + * This template class is used as a "Factory Registry". Objects are + * "entered" into the registry with a "name" using the + * put() method. (The registry then owns the object.) + * These object can then be retrieved using the get() + * method. + * + * Note: This class is Thread-safe. + */ + template + class LOG4CPLUS_EXPORT FactoryRegistry : ObjectRegistryBase { + public: + typedef T product_type; + + virtual ~FactoryRegistry() { + clear(); + } + + // public methods + /** + * Used to enter an object into the registry. (The registry now + * owns object.) + */ + bool put(std::auto_ptr object) { + bool putValResult = putVal(object->getTypeName(), object.get()); + object.release(); + return putValResult; + } + + /** + * Used to retrieve an object from the registry. (The registry + * owns the returned pointer.) + */ + T* get(const log4cplus::tstring& name) const { + return static_cast(getVal(name)); + } + + protected: + virtual void deleteObject(void *object) const { + delete static_cast(object); + } + }; + + + typedef FactoryRegistry AppenderFactoryRegistry; + typedef FactoryRegistry LayoutFactoryRegistry; + typedef FactoryRegistry FilterFactoryRegistry; + typedef FactoryRegistry LocaleFactoryRegistry; + + + /** + * Returns the "singleton" AppenderFactoryRegistry. + */ + LOG4CPLUS_EXPORT AppenderFactoryRegistry& getAppenderFactoryRegistry(); + + /** + * Returns the "singleton" LayoutFactoryRegistry. + */ + LOG4CPLUS_EXPORT LayoutFactoryRegistry& getLayoutFactoryRegistry(); + + /** + * Returns the "singleton" FilterFactoryRegistry. + */ + LOG4CPLUS_EXPORT FilterFactoryRegistry& getFilterFactoryRegistry(); + + /** + * Returns the "singleton" LocaleFactoryRegistry. + */ + LOG4CPLUS_EXPORT LocaleFactoryRegistry& getLocaleFactoryRegistry(); + + + template + class LocalFactoryBase + : public ProductFactoryBase + { + public: + LocalFactoryBase (tchar const * n) + : name (n) + { } + + virtual log4cplus::tstring const & getTypeName() const + { + return name; + } + + private: + log4cplus::tstring name; + }; + + + template + class FactoryTempl + : public LocalFactoryBase + { + public: + typedef typename ProductFactoryBase::ProductPtr ProductPtr; + + FactoryTempl (tchar const * n) + : LocalFactoryBase (n) + { } + + virtual ProductPtr createObject (helpers::Properties const & props) + { + return ProductPtr (new LocalProduct (props)); + } + }; + + + #define LOG4CPLUS_REG_PRODUCT(reg, productprefix, productname, productns, productfact) \ + reg.put ( \ + std::auto_ptr ( \ + new log4cplus::spi::FactoryTempl ( \ + LOG4CPLUS_TEXT(productprefix) \ + LOG4CPLUS_TEXT(#productname)))) + + #define LOG4CPLUS_REG_APPENDER(reg, appendername) \ + LOG4CPLUS_REG_PRODUCT (reg, "log4cplus::", appendername, log4cplus::, \ + log4cplus::spi::AppenderFactory) + + #define LOG4CPLUS_REG_LAYOUT(reg, layoutname) \ + LOG4CPLUS_REG_PRODUCT (reg, "log4cplus::", layoutname, log4cplus::, \ + log4cplus::spi::LayoutFactory) + + #define LOG4CPLUS_REG_FILTER(reg, filtername) \ + LOG4CPLUS_REG_PRODUCT (reg, "log4cplus::spi::", filtername, log4cplus::spi::, \ + log4cplus::spi::FilterFactory) + + #define LOG4CPLUS_REG_LOCALE(reg, name, factory) \ + reg.put (std::auto_ptr ( \ + new factory (name))) + } // namespace spi +} + + +#endif // LOG4CPLUS_SPI_FACTORY_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/spi/filter.h b/src/nar/resources/noarch/include/log4cplus/spi/filter.h new file mode 100644 index 0000000..1febd23 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/filter.h @@ -0,0 +1,287 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: filter.h +// Created: 5/2003 +// Author: Tad E. Smith +// +// +// Copyright 1999-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file + * This header defines Filter and all of it's subclasses. */ + +#ifndef LOG4CPLUS_SPI_FILTER_HEADER_ +#define LOG4CPLUS_SPI_FILTER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + + +namespace log4cplus { + + namespace helpers + { + + class Properties; + + } + + namespace spi { + + + enum FilterResult { DENY, /**< The log event must be dropped immediately + * without consulting with the remaining + * filters, if any, in the chain. */ + NEUTRAL, /**< This filter is neutral with respect to + * the log event; the remaining filters, if + * if any, should be consulted for a final + * decision. */ + ACCEPT /**< The log event must be logged immediately + * without consulting with the remaining + * filters, if any, in the chain. */ + }; + + // Forward Declarations + class Filter; + class InternalLoggingEvent; + + + /** + * This method is used to filter an InternalLoggingEvent. + * + * Note: filter can be NULL. + */ + LOG4CPLUS_EXPORT FilterResult checkFilter(const Filter* filter, + const InternalLoggingEvent& event); + + typedef helpers::SharedObjectPtr FilterPtr; + + + /** + * Users should extend this class to implement customized logging + * event filtering. Note that the {@link Logger} and {@link + * Appender} classes have built-in filtering rules. It is suggested + * that you first use and understand the built-in rules before rushing + * to write your own custom filters. + * + * This abstract class assumes and also imposes that filters be + * organized in a linear chain. The {@link #decide + * decide(LoggingEvent)} method of each filter is called sequentially, + * in the order of their addition to the chain. + * + * If the value {@link #DENY} is returned, then the log event is + * dropped immediately without consulting with the remaining + * filters. + * + * If the value {@link #NEUTRAL} is returned, then the next filter + * in the chain is consulted. If there are no more filters in the + * chain, then the log event is logged. Thus, in the presence of no + * filters, the default behaviour is to log all logging events. + * + * If the value {@link #ACCEPT} is returned, then the log + * event is logged without consulting the remaining filters. + * + * The philosophy of log4cplus filters is largely inspired from the + * Linux ipchains. + */ + class LOG4CPLUS_EXPORT Filter + : public virtual log4cplus::helpers::SharedObject + { + public: + // ctor and dtor + Filter(); + virtual ~Filter(); + + // Methods + /** + * Appends filter to the end of this filter chain. + */ + void appendFilter(FilterPtr filter); + + /** + * If the decision is DENY, then the event will be + * dropped. If the decision is NEUTRAL, then the next + * filter, if any, will be invoked. If the decision is ACCEPT then + * the event will be logged without consulting with other filters in + * the chain. + * + * @param event The LoggingEvent to decide upon. + * @return The decision of the filter. + */ + virtual FilterResult decide(const InternalLoggingEvent& event) const = 0; + + // Data + /** + * Points to the next filter in the filter chain. + */ + FilterPtr next; + }; + + + + /** + * This filter drops all logging events. + * + * You can add this filter to the end of a filter chain to + * switch from the default "accept all unless instructed otherwise" + * filtering behaviour to a "deny all unless instructed otherwise" + * behaviour. + */ + class LOG4CPLUS_EXPORT DenyAllFilter : public Filter { + public: + DenyAllFilter (); + DenyAllFilter (const log4cplus::helpers::Properties&); + + /** + * Always returns the {@link #DENY} regardless of the + * {@link InternalLoggingEvent} parameter. + */ + virtual FilterResult decide(const InternalLoggingEvent& event) const; + }; + + + /** + * This is a very simple filter based on LogLevel matching. + * + * The filter admits two options LogLevelToMatch and + * AcceptOnMatch. If there is an exact match between the value + * of the LogLevelToMatch option and the LogLevel of the {@link + * spi::InternalLoggingEvent}, then the {@link #decide} method returns + * {@link #ACCEPT} in case the AcceptOnMatch option value is set + * to true, if it is false then {@link #DENY} + * is returned. If there is no match, {@link #NEUTRAL} is returned. + */ + class LOG4CPLUS_EXPORT LogLevelMatchFilter : public Filter { + public: + LogLevelMatchFilter(); + LogLevelMatchFilter(const log4cplus::helpers::Properties& p); + + /** + * Return the decision of this filter. + * + * Returns {@link #NEUTRAL} if the LogLevelToMatch + * option is not set or if there is no match. Otherwise, if + * there is a match, then the returned decision is {@link #ACCEPT} + * if the AcceptOnMatch property is set to true. + * The returned decision is {@link #DENY} if the AcceptOnMatch + * property is set to false. + */ + virtual FilterResult decide(const InternalLoggingEvent& event) const; + + private: + // Methods + LOG4CPLUS_PRIVATE void init(); + + // Data + /** Do we return ACCEPT when a match occurs. Default is true. */ + bool acceptOnMatch; + LogLevel logLevelToMatch; + }; + + + + /** + * This is a very simple filter based on LogLevel matching, which can be + * used to reject messages with LogLevels outside a certain range. + * + * The filter admits three options LogLevelMin, LogLevelMax + * and AcceptOnMatch. + * + * If the LogLevel of the Logging event is not between Min and Max + * (inclusive), then {@link #DENY} is returned. + * + * If the Logging event LogLevel is within the specified range, then if + * AcceptOnMatch is true, {@link #ACCEPT} is returned, and if + * AcceptOnMatch is false, {@link #NEUTRAL} is returned. + * + * If LogLevelMin is not defined, then there is no + * minimum acceptable LogLevel (ie a LogLevel is never rejected for + * being too "low"/unimportant). If LogLevelMax is not + * defined, then there is no maximum acceptable LogLevel (ie a + * LogLevel is never rejected for beeing too "high"/important). + * + * Refer to the {@link + * Appender#setThreshold setThreshold} method + * available to all appenders for a more convenient way to + * filter out events by LogLevel. + */ + class LOG4CPLUS_EXPORT LogLevelRangeFilter : public Filter { + public: + // ctors + LogLevelRangeFilter(); + LogLevelRangeFilter(const log4cplus::helpers::Properties& p); + + /** + * Return the decision of this filter. + */ + virtual FilterResult decide(const InternalLoggingEvent& event) const; + + private: + // Methods + LOG4CPLUS_PRIVATE void init(); + + // Data + /** Do we return ACCEPT when a match occurs. Default is true. */ + bool acceptOnMatch; + LogLevel logLevelMin; + LogLevel logLevelMax; + }; + + + + /** + * This is a very simple filter based on string matching. + * + * The filter admits two options StringToMatch and + * AcceptOnMatch. If there is a match between the value of the + * StringToMatch option and the message of the Logging event, + * then the {@link #decide} method returns {@link #ACCEPT} if + * the AcceptOnMatch option value is true, if it is false then + * {@link #DENY} is returned. If there is no match, {@link #NEUTRAL} + * is returned. + */ + class LOG4CPLUS_EXPORT StringMatchFilter : public Filter { + public: + // ctors + StringMatchFilter(); + StringMatchFilter(const log4cplus::helpers::Properties& p); + + /** + * Returns {@link #NEUTRAL} is there is no string match. + */ + virtual FilterResult decide(const InternalLoggingEvent& event) const; + + private: + // Methods + LOG4CPLUS_PRIVATE void init(); + + // Data + /** Do we return ACCEPT when a match occurs. Default is true. */ + bool acceptOnMatch; + log4cplus::tstring stringToMatch; + }; + + } // end namespace spi +} // end namespace log4cplus + +#endif /* LOG4CPLUS_SPI_FILTER_HEADER_ */ + + diff --git a/src/nar/resources/noarch/include/log4cplus/spi/loggerfactory.h b/src/nar/resources/noarch/include/log4cplus/spi/loggerfactory.h new file mode 100644 index 0000000..ad735f1 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/loggerfactory.h @@ -0,0 +1,60 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: loggerfactory.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER +#define LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + + +namespace log4cplus { + // Forward Declarations + class Logger; + class Hierarchy; + + namespace spi { + /** + * Implement this interface to create new instances of Logger or + * a sub-class of Logger. + */ + class LOG4CPLUS_EXPORT LoggerFactory { + public: + /** + * Creates a new Logger object. + */ + virtual Logger makeNewLoggerInstance(const log4cplus::tstring& name, + Hierarchy& h) = 0; + virtual ~LoggerFactory() = 0; + }; + + } // end namespace spi +} // end namespace log4cplus + +#endif // LOG4CPLUS_SPI_LOGGER_FACTORY_HEADER + diff --git a/src/nar/resources/noarch/include/log4cplus/spi/loggerimpl.h b/src/nar/resources/noarch/include/log4cplus/spi/loggerimpl.h new file mode 100644 index 0000000..c7e4633 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/loggerimpl.h @@ -0,0 +1,219 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: loggerimpl.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SPI_LOGGER_HEADER_ +#define LOG4CPLUS_SPI_LOGGER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include + + +namespace log4cplus { + class DefaultLoggerFactory; + + namespace spi { + + /** + * This is the central class in the log4cplus package. One of the + * distintive features of log4cplus are hierarchical loggers and their + * evaluation. + * + * See the user manual for an + * introduction on this class. + */ + class LOG4CPLUS_EXPORT LoggerImpl + : public virtual log4cplus::helpers::SharedObject, + public log4cplus::helpers::AppenderAttachableImpl + { + public: + typedef helpers::SharedObjectPtr SharedLoggerImplPtr; + + // Methods + + /** + * Call the appenders in the hierrachy starting at + * this. If no appenders could be found, emit a + * warning. + * + * This method calls all the appenders inherited from the + * hierarchy circumventing any evaluation of whether to log or not + * to log the particular log request. + * + * @param event The event to log. + */ + virtual void callAppenders(const InternalLoggingEvent& event); + + /** + * Close all attached appenders implementing the AppenderAttachable + * interface. + */ + virtual void closeNestedAppenders(); + + /** + * Check whether this logger is enabled for a given LogLevel passed + * as parameter. + * + * @return boolean True if this logger is enabled for ll. + */ + virtual bool isEnabledFor(LogLevel ll) const; + + /** + * This generic form is intended to be used by wrappers. + */ + virtual void log(LogLevel ll, const log4cplus::tstring& message, + const char* file=NULL, int line=-1); + + virtual void log(spi::InternalLoggingEvent const &); + + /** + * Starting from this logger, search the logger hierarchy for a + * "set" LogLevel and return it. Otherwise, return the LogLevel of the + * root logger. + * + * The Logger class is designed so that this method executes as + * quickly as possible. + */ + virtual LogLevel getChainedLogLevel() const; + + /** + * Returns the assigned LogLevel, if any, for this Logger. + * + * @return LogLevel - the assigned LogLevel. + */ + LogLevel getLogLevel() const { return this->ll; } + + /** + * Set the LogLevel of this Logger. + */ + void setLogLevel(LogLevel _ll) { this->ll = _ll; } + + /** + * Return the the {@link Hierarchy} where this Logger + * instance is attached. + */ + virtual Hierarchy& getHierarchy() const; + + /** + * Return the logger name. + */ + log4cplus::tstring const & getName() const { return name; } + + /** + * Get the additivity flag for this Logger instance. + */ + bool getAdditivity() const; + + /** + * Set the additivity flag for this Logger instance. + */ + void setAdditivity(bool additive); + + virtual ~LoggerImpl(); + + protected: + // Ctors + /** + * This constructor created a new Logger instance and + * sets its name. + * + * It is intended to be used by sub-classes only. You should not + * create loggers directly. + * + * @param name The name of the logger. + * @param h Hierarchy + */ + LoggerImpl(const log4cplus::tstring& name, Hierarchy& h); + + + // Methods + /** + * This method creates a new logging event and logs the event + * without further checks. + */ + virtual void forcedLog(LogLevel ll, + const log4cplus::tstring& message, + const char* file=NULL, + int line=-1); + + virtual void forcedLog(spi::InternalLoggingEvent const & ev); + + + // Data + /** The name of this logger */ + log4cplus::tstring name; + + /** + * The assigned LogLevel of this logger. + */ + LogLevel ll; + + /** + * The parent of this logger. All loggers have at least one + * ancestor which is the root logger. + */ + SharedLoggerImplPtr parent; + + /** + * Additivity is set to true by default, that is children inherit + * the appenders of their ancestors by default. If this variable is + * set to false then the appenders found in the + * ancestors of this logger are not used. However, the children + * of this logger will inherit its appenders, unless the children + * have their additivity flag set to false too. See + * the user manual for more details. + */ + bool additive; + + private: + // Data + /** Loggers need to know what Hierarchy they are in. */ + Hierarchy& hierarchy; + + // Disallow copying of instances of this class + LoggerImpl(const LoggerImpl&); + LoggerImpl& operator=(const LoggerImpl&); + + // Friends + friend class log4cplus::Logger; + friend class log4cplus::DefaultLoggerFactory; + friend class log4cplus::Hierarchy; + }; + + typedef LoggerImpl::SharedLoggerImplPtr SharedLoggerImplPtr; + + } // end namespace spi +} // end namespace log4cplus + +#endif // LOG4CPLUS_SPI_LOGGER_HEADER_ + + diff --git a/src/nar/resources/noarch/include/log4cplus/spi/loggingevent.h b/src/nar/resources/noarch/include/log4cplus/spi/loggingevent.h new file mode 100644 index 0000000..e57bd6e --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/loggingevent.h @@ -0,0 +1,228 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: loggingevent.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SPI_INTERNAL_LOGGING_EVENT_HEADER_ +#define LOG4CPLUS_SPI_INTERNAL_LOGGING_EVENT_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + +namespace log4cplus { + namespace spi { + /** + * The internal representation of logging events. When an affirmative + * decision is made to log then a InternalLoggingEvent + * instance is created. This instance is passed around to the + * different log4cplus components. + * + * This class is of concern to those wishing to extend log4cplus. + */ + class LOG4CPLUS_EXPORT InternalLoggingEvent { + public: + // Ctors + /** + * Instantiate a LoggingEvent from the supplied parameters. + * + * @param logger The logger of this event. + * @param loglevel The LogLevel of this event. + * @param message The message of this event. + * @param filename Name of file where this event has occurred, + * can be NULL. + * @param line Line number in file specified by + * the filename parameter. + */ + InternalLoggingEvent(const log4cplus::tstring& logger, + LogLevel loglevel, const log4cplus::tstring& message, + const char* filename, int line); + + InternalLoggingEvent(const log4cplus::tstring& logger, + LogLevel loglevel, const log4cplus::tstring& ndc, + MappedDiagnosticContextMap const & mdc, + const log4cplus::tstring& message, + const log4cplus::tstring& thread, + log4cplus::helpers::Time time, const log4cplus::tstring& file, + int line); + + InternalLoggingEvent (); + + InternalLoggingEvent( + const log4cplus::spi::InternalLoggingEvent& rhs); + + virtual ~InternalLoggingEvent(); + + void setLoggingEvent (const log4cplus::tstring & logger, + LogLevel ll, const log4cplus::tstring & message, + const char * filename, int line); + + void setFunction (char const * func); + void setFunction (log4cplus::tstring const &); + + + // public virtual methods + /** The application supplied message of logging event. */ + virtual const log4cplus::tstring& getMessage() const; + + /** Returns the 'type' of InternalLoggingEvent. Derived classes + * should override this method. (NOTE: Values <= 1000 are + * reserved for log4cplus and should not be used.) + */ + virtual unsigned int getType() const; + + /** Returns a copy of this object. Derived classes + * should override this method. + */ + virtual std::auto_ptr clone() const; + + + + // public methods + /** The logger of the logging event. It is set by + * the LoggingEvent constructor. + */ + const log4cplus::tstring& getLoggerName() const + { + return loggerName; + } + + /** LogLevel of logging event. */ + LogLevel getLogLevel() const + { + return ll; + } + + /** The nested diagnostic context (NDC) of logging event. */ + const log4cplus::tstring& getNDC() const + { + if (!ndcCached) + { + ndc = log4cplus::getNDC().get(); + ndcCached = true; + } + return ndc; + } + + MappedDiagnosticContextMap const & getMDCCopy () const + { + if (!mdcCached) + { + mdc = log4cplus::getMDC().getContext (); + mdcCached = true; + } + return mdc; + } + + tstring const & getMDC (tstring const & key) const; + + /** The name of thread in which this logging event was generated. */ + const log4cplus::tstring& getThread() const + { + if (! threadCached) + { + thread = thread::getCurrentThreadName (); + threadCached = true; + } + return thread; + } + + //! The alternative name of thread in which this logging event + //! was generated. + const log4cplus::tstring& getThread2() const + { + if (! thread2Cached) + { + thread2 = thread::getCurrentThreadName2 (); + thread2Cached = true; + } + return thread2; + } + + + /** The number of milliseconds elapsed from 1/1/1970 until + * logging event was created. */ + const log4cplus::helpers::Time& getTimestamp() const + { + return timestamp; + } + + /** The is the file where this log statement was written */ + const log4cplus::tstring& getFile() const + { + return file; + } + + /** The is the line where this log statement was written */ + int getLine() const { return line; } + + log4cplus::tstring const & getFunction () const + { + return function; + } + + void gatherThreadSpecificData () const; + + void swap (InternalLoggingEvent &); + + // public operators + log4cplus::spi::InternalLoggingEvent& + operator=(const log4cplus::spi::InternalLoggingEvent& rhs); + + // static methods + static unsigned int getDefaultType(); + + protected: + // Data + log4cplus::tstring message; + log4cplus::tstring loggerName; + LogLevel ll; + mutable log4cplus::tstring ndc; + mutable MappedDiagnosticContextMap mdc; + mutable log4cplus::tstring thread; + mutable log4cplus::tstring thread2; + log4cplus::helpers::Time timestamp; + log4cplus::tstring file; + log4cplus::tstring function; + int line; + /** Indicates whether or not the Threadname has been retrieved. */ + mutable bool threadCached; + mutable bool thread2Cached; + /** Indicates whether or not the NDC has been retrieved. */ + mutable bool ndcCached; + /** Indicates whether or not the MDC has been retrieved. */ + mutable bool mdcCached; + }; + + } // end namespace spi +} // end namespace log4cplus + +#endif // LOG4CPLUS_SPI_INTERNAL_LOGGING_EVENT_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/spi/objectregistry.h b/src/nar/resources/noarch/include/log4cplus/spi/objectregistry.h new file mode 100644 index 0000000..d059474 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/objectregistry.h @@ -0,0 +1,106 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: objectregistry.h +// Created: 3/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SPI_OBJECT_REGISTRY_HEADER_ +#define LOG4CPLUS_SPI_OBJECT_REGISTRY_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include +#include +#include +#include + + +namespace log4cplus { + namespace spi { + + /** + * This is the base class used to implement the functionality required + * by the ObjectRegistry template class. + */ + class LOG4CPLUS_EXPORT ObjectRegistryBase { + public: + // public methods + /** + * Tests to see whether or not an object is bound in the + * registry as name. + */ + bool exists(const log4cplus::tstring& name) const; + + /** + * Returns the names of all registered objects. + */ + std::vector getAllNames() const; + + protected: + // Ctor and Dtor + ObjectRegistryBase(); + virtual ~ObjectRegistryBase(); + + // protected methods + /** + * Used to enter an object into the registry. (The registry now + * owns object.) + */ + bool putVal(const log4cplus::tstring& name, void* object); + + /** + * Used to retrieve an object from the registry. (The registry + * owns the returned pointer.) + */ + void* getVal(const log4cplus::tstring& name) const; + + /** + * Deletes object. + */ + virtual void deleteObject(void *object) const = 0; + + /** + * Deletes all objects from this registry. + */ + virtual void clear(); + + // Types + typedef std::map ObjectMap; + + // Data + thread::Mutex mutex; + ObjectMap data; + + private: + ObjectRegistryBase (ObjectRegistryBase const &); + ObjectRegistryBase & operator = (ObjectRegistryBase const &); + }; + + } +} + + +#endif // LOG4CPLUS_SPI_OBJECT_REGISTRY_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/spi/rootlogger.h b/src/nar/resources/noarch/include/log4cplus/spi/rootlogger.h new file mode 100644 index 0000000..6c466c2 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/spi/rootlogger.h @@ -0,0 +1,75 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: rootlogger.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_ +#define LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +namespace log4cplus { + namespace spi { + + /** + * RootLogger sits at the top of the logger hierachy. It is a + * regular logger except that it provides several guarantees. + * + * First, it cannot be assigned a NOT_SET_LOG_LEVEL + * LogLevel. Second, since root logger cannot have a parent, the + * getChainedLogLevel method always returns the value of the + * ll field without walking the hierarchy. + */ + class LOG4CPLUS_EXPORT RootLogger : public LoggerImpl { + public: + // Ctors + /** + * The root logger names itself as "root". However, the root + * logger cannot be retrieved by name. + */ + RootLogger(Hierarchy& h, LogLevel ll); + + // Methods + /** + * Return the assigned LogLevel value without walking the logger + * hierarchy. + */ + virtual LogLevel getChainedLogLevel() const; + + /** + * Setting a NOT_SET_LOG_LEVEL value to the LogLevel of the root logger + * may have catastrophic results. We prevent this here. + */ + void setLogLevel(LogLevel ll); + + }; + + } // end namespace spi +} // end namespace log4cplus + +#endif // LOG4CPLUS_SPI_ROOT_LOGGER_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/streams.h b/src/nar/resources/noarch/include/log4cplus/streams.h new file mode 100644 index 0000000..df33c4d --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/streams.h @@ -0,0 +1,55 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: streams.h +// Created: 4/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_STREAMS_HEADER_ +#define LOG4CPLUS_STREAMS_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + +#include + + +namespace log4cplus +{ + typedef std::basic_ostream tostream; + typedef std::basic_istream tistream; + typedef std::basic_ostringstream tostringstream; + typedef std::basic_istringstream tistringstream; + extern LOG4CPLUS_EXPORT tostream & tcout; + extern LOG4CPLUS_EXPORT tostream & tcerr; +} + +#if defined (UNICODE) && defined (LOG4CPLUS_ENABLE_GLOBAL_C_STRING_STREAM_INSERTER) + +LOG4CPLUS_EXPORT log4cplus::tostream& operator <<(log4cplus::tostream&, const char* psz ); + +#endif + +#endif // LOG4CPLUS_STREAMS_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/syslogappender.h b/src/nar/resources/noarch/include/log4cplus/syslogappender.h new file mode 100644 index 0000000..60e06bd --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/syslogappender.h @@ -0,0 +1,118 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: syslogappender.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_SYSLOG_APPENDER_HEADER_ +#define LOG4CPLUS_SYSLOG_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + + +namespace log4cplus +{ + + /** + * Appends log events to a file. + * + *

Properties

+ *
+ *
ident
+ *
First argument to openlog(), a string that + * will be prepended to every message.
+ * + *
facility
+ *
Facility is used in combination with syslog level in first + * argument to syslog(). It can be one of the supported facility + * names (case insensitive), e.g. auth, cron, kern, mail, news + * etc.
+ * + *
host
+ *
Destination syslog host. When this property is specified, + * messages are sent using UDP to destination host, otherwise + * messages are logged to local syslog.
+ * + *
port
+ *
Destination port of syslog service on host specified by the + * host property. The default value is port 514.
+ *
+ * + * \note Messages sent to remote syslog using UDP are conforming + * to RFC5424. + */ + class LOG4CPLUS_EXPORT SysLogAppender : public Appender { + public: + // Ctors +#if defined (LOG4CPLUS_HAVE_SYSLOG_H) + SysLogAppender(const tstring& ident); +#endif + SysLogAppender(const tstring& ident, const tstring & host, + int port = 514, const tstring & facility = tstring ()); + SysLogAppender(const log4cplus::helpers::Properties & properties); + + // Dtor + virtual ~SysLogAppender(); + + // Methods + virtual void close(); + + protected: + virtual int getSysLogLevel(const LogLevel& ll) const; + virtual void append(const spi::InternalLoggingEvent& event); +#if defined (LOG4CPLUS_HAVE_SYSLOG_H) + void appendLocal(const spi::InternalLoggingEvent& event); +#endif + void appendRemote(const spi::InternalLoggingEvent& event); + + // Data + tstring ident; + int facility; + + typedef void (SysLogAppender:: * AppendFuncType) ( + const spi::InternalLoggingEvent&); + AppendFuncType appendFunc; + + tstring host; + int port; + helpers::Socket syslogSocket; + + static tstring const remoteTimeFormat; + + private: + // Disallow copying of instances of this class + SysLogAppender(const SysLogAppender&); + SysLogAppender& operator=(const SysLogAppender&); + + std::string identStr; + tstring hostname; + }; + +} // end namespace log4cplus + + +#endif // LOG4CPLUS_SYSLOG_APPENDER_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/tchar.h b/src/nar/resources/noarch/include/log4cplus/tchar.h new file mode 100644 index 0000000..217fc76 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/tchar.h @@ -0,0 +1,63 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/** @file */ + +#ifndef LOG4CPLUS_TCHAR_HEADER_ +#define LOG4CPLUS_TCHAR_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined (_WIN32) +#include +#endif + + +#ifdef UNICODE +# define LOG4CPLUS_TEXT2(STRING) L##STRING +#else +# define LOG4CPLUS_TEXT2(STRING) STRING +#endif // UNICODE +#define LOG4CPLUS_TEXT(STRING) LOG4CPLUS_TEXT2(STRING) + + +namespace log4cplus +{ + +#if defined (UNICODE) +typedef wchar_t tchar; + +#else +typedef char tchar; + +#endif + +} // namespace log4cplus + + +#endif // LOG4CPLUS_TCHAR_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-impl.h b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-impl.h new file mode 100644 index 0000000..6a2df91 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-impl.h @@ -0,0 +1,240 @@ +// -*- C++ -*- +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_THREAD_SYNCPRIMS_IMPL_H +#define LOG4CPLUS_THREAD_SYNCPRIMS_IMPL_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if ! defined (INSIDE_LOG4CPLUS) +# error "This header must not be be used outside log4cplus' implementation files." +#endif + +#include +#include +#if defined (_WIN32) +# include + +#elif defined (LOG4CPLUS_USE_PTHREADS) +# include +# include +# include +# if defined (LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE) +# include +# include +# if defined (LOG4CPLUS_HAVE_SYS_TYPES_H) +# include +# endif +# if defined (LOG4CPLUS_HAVE_UNISTD_H) +# include +# endif +# endif +# if defined (LOG4CPLUS_HAVE_FCNTL_H) +# include +# endif +# include + +#endif + + +namespace log4cplus { namespace thread { namespace impl { + + +LOG4CPLUS_EXPORT void LOG4CPLUS_ATTRIBUTE_NORETURN + syncprims_throw_exception (char const * const msg, + char const * const file, int line); + + +#define LOG4CPLUS_THROW_RTE(msg) \ + do { syncprims_throw_exception (msg, __FILE__, __LINE__); } while (0) + + +class ManualResetEvent; + + +class Mutex + : public MutexImplBase +{ +public: + explicit Mutex (log4cplus::thread::Mutex::Type); + ~Mutex (); + + void lock () const; + void unlock () const; + +private: +#if defined (LOG4CPLUS_USE_PTHREADS) + mutable pthread_mutex_t mtx; + friend class ManualResetEvent; +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) + mutable CRITICAL_SECTION cs; +#endif + + Mutex (Mutex const &); + Mutex & operator = (Mutex &); +}; + + +typedef SyncGuard MutexGuard; + + +class Semaphore + : public SemaphoreImplBase +{ +public: + Semaphore (unsigned max, unsigned initial); + ~Semaphore (); + + void lock () const; + void unlock () const; + +private: +#if defined (LOG4CPLUS_USE_PTHREADS) +# if defined (LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE) + sem_t * sem; +# else + mutable sem_t sem; +# endif +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) + HANDLE sem; +#endif + + Semaphore (Semaphore const &); + Semaphore & operator = (Semaphore const &); +}; + + +typedef SyncGuard SemaphoreGuard; + + +class FairMutex + : public FairMutexImplBase +{ +public: + FairMutex (); + ~FairMutex (); + + void lock () const; + void unlock () const; + +private: +#if defined (LOG4CPLUS_USE_PTHREADS) + Semaphore sem; +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) + HANDLE mtx; +#endif + + FairMutex (FairMutex const &); + FairMutex & operator = (FairMutex &); +}; + + +typedef SyncGuard FairMutexGuard; + + +class ManualResetEvent + : public ManualResetEventImplBase +{ +public: + ManualResetEvent (bool = false); + ~ManualResetEvent (); + + void signal () const; + void wait () const; + bool timed_wait (unsigned long msec) const; + void reset () const; + +private: +#if defined (LOG4CPLUS_USE_PTHREADS) + mutable pthread_cond_t cv; + mutable Mutex mtx; + mutable volatile unsigned sigcount; + mutable volatile bool signaled; +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) + HANDLE ev; +#endif + + ManualResetEvent (ManualResetEvent const &); + ManualResetEvent & operator = (ManualResetEvent const &); +}; + + +class SharedMutex + : public SharedMutexImplBase +{ +public: + SharedMutex (); + ~SharedMutex (); + + void rdlock () const; + void wrlock () const; + void rdunlock () const; + void wrunlock () const; + +private: +#if defined (LOG4CPLUS_POOR_MANS_SHAREDMUTEX) + Mutex m1; + Mutex m2; + Mutex m3; + Semaphore w; + mutable unsigned writer_count; + Semaphore r; + mutable unsigned reader_count; + +#elif defined (LOG4CPLUS_USE_PTHREADS) + void unlock () const; + + mutable pthread_rwlock_t rwl; + +#elif defined (LOG4CPLUS_USE_SRW_LOCK) + mutable SRWLOCK srwl; + +#endif + + SharedMutex (SharedMutex const &); + SharedMutex & operator = (SharedMutex const &); +}; + + +} } } // namespace log4cplus { namespace thread { namespace impl { + + +// Include the appropriate implementations of the classes declared +// above. + +#if defined (LOG4CPLUS_USE_PTHREADS) +# include +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) +# include +#endif + + +#undef LOG4CPLUS_THROW_RTE + + +#endif // LOG4CPLUS_THREAD_SYNCPRIMS_IMPL_H diff --git a/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-pmsm.h b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-pmsm.h new file mode 100644 index 0000000..34b315d --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-pmsm.h @@ -0,0 +1,119 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//! @file +//! This file contains implementations of reader-writer locking +//! primitive using other primitives, IOW poor man's rwlock. +//! It does not contain any include guards because it is only a fragment +//! to be included by syncprims-{pthreads,win32}.h. + + +#if ! defined (INSIDE_LOG4CPLUS) +# error "This header must not be be used outside log4cplus' implementation files." +#endif + + +// This implements algorithm described in "Concurrent Control with "Readers" +// and "Writers"; P.J. Courtois, F. Heymans, and D.L. Parnas; +// MBLE Research Laboratory; Brussels, Belgium" + + +inline +SharedMutex::SharedMutex () + : m1 (log4cplus::thread::Mutex::DEFAULT) + , m2 (log4cplus::thread::Mutex::DEFAULT) + , m3 (log4cplus::thread::Mutex::DEFAULT) + , w (1, 1) + , writer_count (0) + , r (1, 1) + , reader_count (0) +{ } + + +inline +SharedMutex::~SharedMutex () +{ } + + +inline +void +SharedMutex::rdlock () const +{ + MutexGuard m3_guard (m3); + SemaphoreGuard r_guard (r); + MutexGuard m1_guard (m1); + if (reader_count + 1 == 1) + w.lock (); + + reader_count += 1; +} + + +inline +void +SharedMutex::rdunlock () const +{ + MutexGuard m1_guard (m1); + if (reader_count - 1 == 0) + w.unlock (); + + reader_count -= 1; +} + + +inline +void +SharedMutex::wrlock () const +{ + { + MutexGuard m2_guard (m2); + if (writer_count + 1 == 1) + r.lock (); + + writer_count += 1; + } + try + { + w.lock (); + } + catch (...) + { + MutexGuard m2_guard (m2); + writer_count -= 1; + throw; + } +} + + +inline +void +SharedMutex::wrunlock () const +{ + w.unlock (); + MutexGuard m2_guard (m2); + if (writer_count - 1 == 0) + r.unlock (); + + writer_count -= 1; +} diff --git a/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-pthreads.h b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-pthreads.h new file mode 100644 index 0000000..0d3167c --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-pthreads.h @@ -0,0 +1,507 @@ +// -*- C++ -*- +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//! @file +//! This file contains implementations of synchronization +//! primitives using the POSIX threads. It does not contain any +//! include guards because it is only a fragment to be included by +//! syncprims.h. + +#include "log4cplus/thread/threads.h" +#include +#include + + +namespace log4cplus { namespace thread { namespace impl { + + +struct PthreadMutexAttr +{ + PthreadMutexAttr () + { + int ret = pthread_mutexattr_init (&attr); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("PthreadMutexAttr::PthreadMutexAttr"); + } + + + ~PthreadMutexAttr () + { + try + { + int ret = pthread_mutexattr_destroy (&attr); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("PthreadMutexAttr::~PthreadMutexAttr"); + } + catch (...) + { } + } + + + void + set_type (log4cplus::thread::Mutex::Type t) + { + int mutex_type; + switch (t) + { + case log4cplus::thread::Mutex::RECURSIVE: + mutex_type = PTHREAD_MUTEX_RECURSIVE; + break; + + default: + mutex_type = PTHREAD_MUTEX_DEFAULT; + } + + int ret = pthread_mutexattr_settype (&attr, mutex_type); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("PthreadMutexAttr::set_type"); + } + + + pthread_mutexattr_t attr; +}; + + +// +// +// + +inline +Mutex::Mutex (log4cplus::thread::Mutex::Type t) +{ + PthreadMutexAttr attr; + attr.set_type (t); + + int ret = pthread_mutex_init (&mtx, &attr.attr); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Mutex::Mutex"); +} + + +inline +Mutex::~Mutex () +{ + try + { + int ret = pthread_mutex_destroy (&mtx); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Mutex::~Mutex"); + } + catch (...) + { } +} + + +inline +void +Mutex::lock () const +{ + int ret = pthread_mutex_lock (&mtx); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Mutex::lock"); +} + + +inline +void +Mutex::unlock () const +{ + int ret = pthread_mutex_unlock (&mtx); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Mutex::unlock"); +} + + +// +// +// + +inline +Semaphore::Semaphore (unsigned max, unsigned initial) +{ + unsigned const sem_value_max = +#if defined (SEM_VALUE_MAX) + SEM_VALUE_MAX +#else + (std::numeric_limits::max) () +#endif + ; + + unsigned const limited_max = (std::min) (max, sem_value_max); + unsigned const limited_initial = (std::min) (initial, limited_max); + int ret = 0; + +#if defined (LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE) + std::ostringstream oss; + char size_check[2 * (static_cast(sizeof (std::ptrdiff_t)) + - static_cast(sizeof (this))) + 1]; + (void)size_check; + oss << getpid () << "-" << reinterpret_cast(this); + std::string name (oss.str ()); + + sem = sem_open (name.c_str (), O_CREAT, S_IRWXU | S_IRWXG, limited_max); + ret = sem == SEM_FAILED; + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::Semaphore"); + + try + { + // Unlink the semaphore early to simulate anonymous semaphore. + ret = sem_unlink (name.c_str ()); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::Semaphore"); + } + catch (std::runtime_error const &) + { + ret = sem_close (sem); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::~Semaphore"); + + throw; + } + +#else + ret = sem_init (&sem, 0, limited_max); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::Semaphore"); + +#endif + + try + { + for (unsigned i = limited_initial; i < limited_max; ++i) + lock (); + } + catch (std::runtime_error const &) + { +#if defined (LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE) + ret = sem_close (sem); +#else + ret = sem_destroy (&sem); +#endif + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::~Semaphore"); + + throw; + } +} + + +inline +Semaphore::~Semaphore () +{ + try + { + int ret = 0; +#if defined (LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE) + ret = sem_close (sem); +#else + ret = sem_destroy (&sem); +#endif + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::~Semaphore"); + } + catch (...) + { } +} + + +inline +void +Semaphore::unlock () const +{ +#if defined (LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE) + int ret = sem_post (sem); +#else + int ret = sem_post (&sem); +#endif + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::unlock"); +} + + +inline +void +Semaphore::lock () const +{ +#if defined (LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE) + int ret = sem_wait (sem); +#else + int ret = sem_wait (&sem); +#endif + if (ret != 0) + LOG4CPLUS_THROW_RTE ("Semaphore::lock"); +} + + +// +// +// + + +inline +FairMutex::FairMutex () + : sem (1, 1) +{ } + + +inline +FairMutex::~FairMutex () +{ } + + +inline +void +FairMutex::lock () const +{ + sem.lock (); +} + + +inline +void +FairMutex::unlock () const +{ + sem.unlock (); +} + + +// +// +// + +inline +ManualResetEvent::ManualResetEvent (bool sig) + : mtx (log4cplus::thread::Mutex::DEFAULT) + , sigcount (0) + , signaled (sig) +{ + int ret = pthread_cond_init (&cv, 0); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("ManualResetEvent::ManualResetEvent"); +} + + +inline +ManualResetEvent::~ManualResetEvent () +{ + try + { + int ret = pthread_cond_destroy (&cv); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("ManualResetEvent::~ManualResetEvent"); + } + catch (...) + { } +} + + +inline +void +ManualResetEvent::signal () const +{ + MutexGuard mguard (mtx); + + signaled = true; + sigcount += 1; + int ret = pthread_cond_broadcast (&cv); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("ManualResetEVent::signal"); + +} + + +inline +void +ManualResetEvent::wait () const +{ + MutexGuard mguard (mtx); + + if (! signaled) + { + unsigned prev_count = sigcount; + do + { + int ret = pthread_cond_wait (&cv, &mtx.mtx); + if (ret != 0) + { + mguard.unlock (); + mguard.detach (); + LOG4CPLUS_THROW_RTE ("ManualResetEvent::wait"); + } + } + while (prev_count == sigcount); + } +} + + +inline +bool +ManualResetEvent::timed_wait (unsigned long msec) const +{ + MutexGuard mguard (mtx); + + if (! signaled) + { + helpers::Time const wakeup_time (helpers::Time::gettimeofday () + + helpers::Time (msec / 1000, (msec % 1000) * 1000)); + struct timespec const ts = {wakeup_time.sec (), + wakeup_time.usec () * 1000}; + unsigned prev_count = sigcount; + do + { + int ret = pthread_cond_timedwait (&cv, &mtx.mtx, &ts); + switch (ret) + { + case 0: + break; + + case ETIMEDOUT: + return false; + + default: + mguard.unlock (); + mguard.detach (); + LOG4CPLUS_THROW_RTE ("ManualResetEvent::timed_wait"); + } + } + while (prev_count == sigcount); + } + + return true; +} + + +inline +void +ManualResetEvent::reset () const +{ + MutexGuard mguard (mtx); + + signaled = false; +} + + +// +// +// + +#if defined (LOG4CPLUS_POOR_MANS_SHAREDMUTEX) +#include "log4cplus/thread/impl/syncprims-pmsm.h" + +#else +inline +SharedMutex::SharedMutex () +{ + int ret = pthread_rwlock_init (&rwl, 0); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("SharedMutex::SharedMutex"); +} + + +inline +SharedMutex::~SharedMutex () +{ + try + { + int ret = pthread_rwlock_destroy (&rwl); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("SharedMutex::~SharedMutex"); + } + catch (...) + { } +} + + +inline +void +SharedMutex::rdlock () const +{ + int ret; + + do + { + ret = pthread_rwlock_rdlock (&rwl); + switch (ret) + { + case EAGAIN: + // The read lock could not be acquired because the maximum + // number of read locks for rwlock has been exceeded. + + log4cplus::thread::yield (); + // Fall through. + + case 0: + break; + + default: + LOG4CPLUS_THROW_RTE ("SharedMutex::rdlock"); + + } + } + while (ret != 0); +} + + +inline +void +SharedMutex::rdunlock () const +{ + unlock (); +} + + +inline +void +SharedMutex::wrlock () const +{ + int ret = pthread_rwlock_wrlock (&rwl); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("SharedMutex::wrlock"); +} + + +inline +void +SharedMutex::wrunlock () const +{ + unlock (); +} + + +inline +void +SharedMutex::unlock () const +{ + int ret = pthread_rwlock_unlock (&rwl); + if (ret != 0) + LOG4CPLUS_THROW_RTE ("SharedMutex::unlock"); + +} + + +#endif + + +} } } // namespace log4cplus { namespace thread { namespace impl { diff --git a/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-win32.h b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-win32.h new file mode 100644 index 0000000..35cc423 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/impl/syncprims-win32.h @@ -0,0 +1,328 @@ +// -*- C++ -*- +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//! @file +//! This file contains implementations of synchronization +//! primitives using the Win32 API. It does not contain any include +//! guards because it is only a fragment to be included by +//! syncprims.h. + +#include + + +namespace log4cplus { namespace thread { namespace impl { + + +// +// +// + +inline +bool +InitializeCriticalSection_wrapInternal (LPCRITICAL_SECTION cs) +{ +#if defined (_MSC_VER) + __try + { +#endif + + InitializeCriticalSection (cs); + +#if defined (_MSC_VER) + } + __except (GetExceptionCode() == STATUS_NO_MEMORY + ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + return false; + } +#endif + + return true; +} + + +inline +void +InitializeCriticalSection_wrap (LPCRITICAL_SECTION cs) +{ + if (! InitializeCriticalSection_wrapInternal (cs)) + throw std::runtime_error ( + "InitializeCriticalSection: STATUS_NO_MEMORY"); +} + + +inline +Mutex::Mutex (log4cplus::thread::Mutex::Type) +{ + InitializeCriticalSection_wrap (&cs); +} + + +inline +Mutex::~Mutex () +{ + DeleteCriticalSection (&cs); +} + + +inline +void +Mutex::lock () const +{ + EnterCriticalSection (&cs); +} + + +inline +void +Mutex::unlock () const +{ + LeaveCriticalSection (&cs); +} + + +// +// +// + +inline +Semaphore::Semaphore (unsigned max, unsigned initial) +{ + sem = CreateSemaphore (0, initial, max, 0); + if (! sem) + LOG4CPLUS_THROW_RTE ("Semaphore::Semaphore"); +} + + +inline +Semaphore::~Semaphore () +{ + try + { + if (! CloseHandle (sem)) + LOG4CPLUS_THROW_RTE ("Semaphore::~Semaphore"); + } + catch (...) + { } +} + + +inline +void +Semaphore::unlock () const +{ + DWORD ret = ReleaseSemaphore (sem, 1, 0); + if (! ret) + LOG4CPLUS_THROW_RTE ("Semaphore::unlock"); +} + + +inline +void +Semaphore::lock () const +{ + DWORD ret = WaitForSingleObject (sem, INFINITE); + if (ret != WAIT_OBJECT_0) + LOG4CPLUS_THROW_RTE ("Semaphore::lock"); +} + + +// +// +// + + +inline +FairMutex::FairMutex () +{ + mtx = CreateMutex (0, false, 0); + if (! mtx) + LOG4CPLUS_THROW_RTE ("FairMutex::FairMutex"); +} + + +inline +FairMutex::~FairMutex () +{ + try + { + if (! CloseHandle (mtx)) + LOG4CPLUS_THROW_RTE ("FairMutex::~FairMutex"); + } + catch (...) + { } +} + + +inline +void +FairMutex::lock () const +{ + DWORD ret = WaitForSingleObject (mtx, INFINITE); + if (ret != WAIT_OBJECT_0) + LOG4CPLUS_THROW_RTE ("FairMutex::lock"); +} + + +inline +void +FairMutex::unlock () const +{ + if (! ReleaseMutex (mtx)) + LOG4CPLUS_THROW_RTE ("FairMutex::unlock"); +} + + +// +// +// + +inline +ManualResetEvent::ManualResetEvent (bool sig) +{ + ev = CreateEvent (0, true, sig, 0); + if (! ev) + LOG4CPLUS_THROW_RTE ("ManualResetEvent::ManualResetEvent"); +} + + +inline +ManualResetEvent::~ManualResetEvent () +{ + try + { + if (! CloseHandle (ev)) + LOG4CPLUS_THROW_RTE ("ManualResetEvent::~ManualResetEvent"); + } + catch (...) + { } +} + + +inline +void +ManualResetEvent::signal () const +{ + if (! SetEvent (ev)) + LOG4CPLUS_THROW_RTE ("ManualResetEVent::signal"); +} + + +inline +void +ManualResetEvent::wait () const +{ + DWORD ret = WaitForSingleObject (ev, INFINITE); + if (ret != WAIT_OBJECT_0) + LOG4CPLUS_THROW_RTE ("ManualResetEvent::wait"); +} + + +inline +bool +ManualResetEvent::timed_wait (unsigned long msec) const +{ + DWORD ret = WaitForSingleObject (ev, static_cast(msec)); + switch(ret) + { + case WAIT_OBJECT_0: + return true; + + case WAIT_TIMEOUT: + return false; + + default: + LOG4CPLUS_THROW_RTE ("ManualResetEvent::timed_wait"); + // Silence warnings about not returning any value from function + // returning bool. + return false; + } +} + + +inline +void +ManualResetEvent::reset () const +{ + if (! ResetEvent (ev)) + LOG4CPLUS_THROW_RTE ("ManualResetEvent::reset"); +} + + +// +// +// + +#if defined (LOG4CPLUS_POOR_MANS_SHAREDMUTEX) +#include "log4cplus/thread/impl/syncprims-pmsm.h" + +#else +inline +SharedMutex::SharedMutex () +{ + InitializeSRWLock (&srwl); +} + + +inline +SharedMutex::~SharedMutex () +{ } + + +inline +void +SharedMutex::rdlock () const +{ + AcquireSRWLockShared (&srwl); +} + + +inline +void +SharedMutex::rdunlock () const +{ + ReleaseSRWLockShared (&srwl); +} + + +inline +void +SharedMutex::wrlock () const +{ + AcquireSRWLockExclusive (&srwl); +} + + +inline +void +SharedMutex::wrunlock () const +{ + ReleaseSRWLockExclusive (&srwl); +} + + +#endif + + +} } } // namespace log4cplus { namespace thread { namespace impl { diff --git a/src/nar/resources/noarch/include/log4cplus/thread/impl/threads-impl.h b/src/nar/resources/noarch/include/log4cplus/thread/impl/threads-impl.h new file mode 100644 index 0000000..88b40b2 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/impl/threads-impl.h @@ -0,0 +1,160 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: threads.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_ +#define LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined (_WIN32) +#include +#endif +#include +#include +#include + +#if ! defined (INSIDE_LOG4CPLUS) +# error "This header must not be be used outside log4cplus' implementation files." +#endif + + +namespace log4cplus { namespace thread { namespace impl { + + +#if defined (LOG4CPLUS_USE_PTHREADS) + +typedef pthread_t os_handle_type; +typedef pthread_t os_id_type; + + +inline +pthread_t +getCurrentThreadId () +{ + return pthread_self (); +} + + +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) + +typedef HANDLE os_handle_type; +typedef DWORD os_id_type; + + +inline +DWORD +getCurrentThreadId () +{ + return GetCurrentThreadId (); +} + + +#elif defined (LOG4CPLUS_SINGLE_THREADED) + +typedef void * os_handle_type; +typedef int os_id_type; + + +inline +int +getCurrentThreadId () +{ + return 1; +} + + +#endif + + +#ifndef LOG4CPLUS_SINGLE_THREADED + + +struct ThreadStart +{ +# ifdef LOG4CPLUS_USE_PTHREADS +static void* threadStartFuncWorker(void *); +# elif defined(LOG4CPLUS_USE_WIN32_THREADS) +static unsigned threadStartFuncWorker(void *); +# endif +}; + + +/** + * There are many cross-platform C++ Threading libraries. The goal of + * this class is not to replace (or match in functionality) those + * libraries. The goal of this class is to provide a simple Threading + * class with basic functionality. + */ +class Thread + : public ThreadImplBase +{ +public: + Thread(); + bool isRunning() const; + os_id_type getThreadId() const; + os_handle_type getThreadHandle () const; + void start(); + void join (); + +protected: + // Force objects to be constructed on the heap + virtual ~Thread(); + virtual void run() = 0; + +private: + // Friends. + friend struct ThreadStart; + + enum Flags + { + fRUNNING = 0x01, + fJOINED = 0x02 + }; + + unsigned flags; + + os_handle_type handle; + +# if defined(LOG4CPLUS_USE_WIN32_THREADS) + unsigned thread_id; +# endif + + // Disallow copying of instances of this class. + Thread(const Thread&); + Thread& operator=(const Thread&); +}; + +typedef helpers::SharedObjectPtr ThreadPtr; + + +#endif // LOG4CPLUS_SINGLE_THREADED + + +} } } // namespace log4cplus { namespace thread { namespace impl { + + +#endif // LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/thread/impl/tls.h b/src/nar/resources/noarch/include/log4cplus/thread/impl/tls.h new file mode 100644 index 0000000..5a390ae --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/impl/tls.h @@ -0,0 +1,180 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_THREAD_IMPL_TLS_H +#define LOG4CPLUS_THREAD_IMPL_TLS_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + +#if ! defined (INSIDE_LOG4CPLUS) +# error "This header must not be be used outside log4cplus' implementation files." +#endif + +#ifdef LOG4CPLUS_USE_PTHREADS +# include + +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) +# include + +#elif defined (LOG4CPLUS_SINGLE_THREADED) +# include + +#endif + + +namespace log4cplus { namespace thread { namespace impl { + + +typedef void * tls_value_type; +typedef void (* tls_init_cleanup_func_type)(void *); + +#ifdef LOG4CPLUS_USE_PTHREADS +typedef pthread_key_t * tls_key_type; + +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) +typedef DWORD tls_key_type; + +#elif defined (LOG4CPLUS_SINGLE_THREADED) +typedef std::size_t tls_key_type; + +#endif + + +inline tls_key_type tls_init (tls_init_cleanup_func_type); +inline tls_value_type tls_get_value (tls_key_type); +inline void tls_set_value (tls_key_type, tls_value_type); +inline void tls_cleanup (tls_key_type); + + +#if defined (LOG4CPLUS_USE_PTHREADS) +tls_key_type +tls_init (tls_init_cleanup_func_type cleanupfunc) +{ + pthread_key_t * key = new pthread_key_t; + pthread_key_create (key, cleanupfunc); + return key; +} + + +tls_value_type +tls_get_value (tls_key_type key) +{ + return pthread_getspecific (*key); +} + + +void +tls_set_value (tls_key_type key, tls_value_type value) +{ + pthread_setspecific(*key, value); +} + + +void +tls_cleanup (tls_key_type key) +{ + pthread_key_delete (*key); + delete key; +} + + +#elif defined (LOG4CPLUS_USE_WIN32_THREADS) +tls_key_type +tls_init (tls_init_cleanup_func_type) +{ + return TlsAlloc (); +} + + +tls_value_type tls_get_value (tls_key_type k) +{ + return TlsGetValue (k); +} + + +void +tls_set_value (tls_key_type k, tls_value_type value) +{ + TlsSetValue (k, value); +} + + +void +tls_cleanup (tls_key_type k) +{ + TlsFree (k); +} + + +#elif defined (LOG4CPLUS_SINGLE_THREADED) +extern std::vector * tls_single_threaded_values; + + +tls_key_type +tls_init (tls_init_cleanup_func_type) +{ + if (! tls_single_threaded_values) + tls_single_threaded_values = new std::vector; + tls_key_type key = tls_single_threaded_values->size (); + tls_single_threaded_values->resize (key + 1); + return key; +} + + +tls_value_type +tls_get_value (tls_key_type k) +{ + assert (k < tls_single_threaded_values->size ()); + return (*tls_single_threaded_values)[k]; +} + + +void +tls_set_value (tls_key_type k, tls_value_type val) +{ + assert (k < tls_single_threaded_values->size ()); + (*tls_single_threaded_values)[k] = val; +} + + +void +tls_cleanup (tls_key_type k) +{ + assert (k < tls_single_threaded_values->size ()); + (*tls_single_threaded_values)[k] = 0; +} + +#endif + + +} } } // namespace log4cplus { namespace thread { namespace impl { + +#endif // LOG4CPLUS_THREAD_IMPL_TLS_H diff --git a/src/nar/resources/noarch/include/log4cplus/thread/syncprims-pub-impl.h b/src/nar/resources/noarch/include/log4cplus/thread/syncprims-pub-impl.h new file mode 100644 index 0000000..dd53bce --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/syncprims-pub-impl.h @@ -0,0 +1,299 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_THREAD_SYNCPRIMS_PUB_IMPL_H +#define LOG4CPLUS_THREAD_SYNCPRIMS_PUB_IMPL_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if (defined (LOG4CPLUS_INLINES_ARE_EXPORTED) \ + && defined (LOG4CPLUS_BUILD_DLL)) \ + || defined (LOG4CPLUS_ENABLE_SYNCPRIMS_PUB_IMPL) +#include + +#if defined (LOG4CPLUS_SINGLE_THREADED) +# define LOG4CPLUS_THREADED(x) +#else +# include +# define LOG4CPLUS_THREADED(x) (x) +#endif + + +namespace log4cplus { namespace thread { + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +MutexImplBase::~MutexImplBase () +{ } + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +Mutex::Mutex (Mutex::Type t) + : mtx (LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0) +{ } + + +LOG4CPLUS_INLINE_EXPORT +Mutex::~Mutex () +{ + LOG4CPLUS_THREADED (delete static_cast(mtx)); +} + + +LOG4CPLUS_INLINE_EXPORT +void +Mutex::lock () const +{ + LOG4CPLUS_THREADED (static_cast(mtx)->lock ()); +} + + +LOG4CPLUS_INLINE_EXPORT +void +Mutex::unlock () const +{ + LOG4CPLUS_THREADED (static_cast(mtx)->unlock ()); +} + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +SemaphoreImplBase::~SemaphoreImplBase () +{ } + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +Semaphore::Semaphore (unsigned LOG4CPLUS_THREADED (max), + unsigned LOG4CPLUS_THREADED (initial)) + : sem (LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)) + 0) +{ } + + +LOG4CPLUS_INLINE_EXPORT +Semaphore::~Semaphore () +{ + LOG4CPLUS_THREADED (delete static_cast(sem)); +} + + +LOG4CPLUS_INLINE_EXPORT +void +Semaphore::lock () const +{ + LOG4CPLUS_THREADED (static_cast(sem)->lock ()); +} + + +LOG4CPLUS_INLINE_EXPORT +void +Semaphore::unlock () const +{ + LOG4CPLUS_THREADED (static_cast(sem)->unlock ()); +} + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +FairMutexImplBase::~FairMutexImplBase () +{ } + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +FairMutex::FairMutex () + : mtx (LOG4CPLUS_THREADED (new impl::FairMutex) + 0) +{ } + + +LOG4CPLUS_INLINE_EXPORT +FairMutex::~FairMutex () +{ + LOG4CPLUS_THREADED (delete static_cast(mtx)); +} + + +LOG4CPLUS_INLINE_EXPORT +void +FairMutex::lock () const +{ + LOG4CPLUS_THREADED (static_cast(mtx)->lock ()); +} + + +LOG4CPLUS_INLINE_EXPORT +void +FairMutex::unlock () const +{ + LOG4CPLUS_THREADED (static_cast(mtx)->unlock ()); +} + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +ManualResetEventImplBase::~ManualResetEventImplBase () +{ } + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +ManualResetEvent::ManualResetEvent (bool LOG4CPLUS_THREADED (sig)) + : ev (LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)) + 0) +{ } + + +LOG4CPLUS_INLINE_EXPORT +ManualResetEvent::~ManualResetEvent () +{ + LOG4CPLUS_THREADED (delete static_cast(ev)); +} + + +LOG4CPLUS_INLINE_EXPORT +void +ManualResetEvent::signal () const +{ + LOG4CPLUS_THREADED (static_cast(ev)->signal ()); +} + + +LOG4CPLUS_INLINE_EXPORT +void +ManualResetEvent::wait () const +{ + LOG4CPLUS_THREADED (static_cast(ev)->wait ()); +} + + +LOG4CPLUS_INLINE_EXPORT +bool +ManualResetEvent::timed_wait (unsigned long LOG4CPLUS_THREADED (msec)) const +{ +#if defined (LOG4CPLUS_SINGLE_THREADED) + return true; +#else + return static_cast(ev)->timed_wait (msec); +#endif +} + + +LOG4CPLUS_INLINE_EXPORT +void +ManualResetEvent::reset () const +{ + LOG4CPLUS_THREADED (static_cast(ev)->reset ()); +} + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +SharedMutexImplBase::~SharedMutexImplBase () +{ } + + +// +// +// + +LOG4CPLUS_INLINE_EXPORT +SharedMutex::SharedMutex () + : sm (LOG4CPLUS_THREADED (new impl::SharedMutex) + 0) +{ } + + +LOG4CPLUS_INLINE_EXPORT +SharedMutex::~SharedMutex () +{ } + + +LOG4CPLUS_INLINE_EXPORT +void +SharedMutex::rdlock () const +{ + LOG4CPLUS_THREADED (static_cast(sm)->rdlock ()); +} + + +LOG4CPLUS_INLINE_EXPORT +void +SharedMutex::wrlock () const +{ + LOG4CPLUS_THREADED (static_cast(sm)->wrlock ()); +} + + +LOG4CPLUS_INLINE_EXPORT +void +SharedMutex::rdunlock () const +{ + LOG4CPLUS_THREADED (static_cast(sm)->rdunlock ()); +} + + +LOG4CPLUS_INLINE_EXPORT +void +SharedMutex::wrunlock () const +{ + LOG4CPLUS_THREADED (static_cast(sm)->wrunlock ()); +} + + +} } // namespace log4cplus { namespace thread { + +#endif // LOG4CPLUS_ENABLE_SYNCPRIMS_PUB_IMPL + +#endif // LOG4CPLUS_THREAD_SYNCPRIMS_PUB_IMPL_H diff --git a/src/nar/resources/noarch/include/log4cplus/thread/syncprims.h b/src/nar/resources/noarch/include/log4cplus/thread/syncprims.h new file mode 100644 index 0000000..d043845 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/syncprims.h @@ -0,0 +1,382 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_THREAD_SYNCPRIMS_H +#define LOG4CPLUS_THREAD_SYNCPRIMS_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + + +namespace log4cplus { namespace thread { + + +template +class SyncGuard +{ +public: + SyncGuard (); + SyncGuard (SP const &); + ~SyncGuard (); + + void lock (); + void unlock (); + void attach (SP const &); + void attach_and_lock (SP const &); + void detach (); + +private: + SP const * sp; + + SyncGuard (SyncGuard const &); + SyncGuard & operator = (SyncGuard const &); +}; + + +class ManualResetEvent; + + +class MutexImplBase +{ +protected: + ~MutexImplBase (); +}; + + +class LOG4CPLUS_EXPORT Mutex +{ +public: + enum Type + { + DEFAULT, + RECURSIVE + }; + + explicit Mutex (Type = RECURSIVE); + ~Mutex (); + + void lock () const; + void unlock () const; + +private: + MutexImplBase * mtx; + + Mutex (Mutex const &); + Mutex & operator = (Mutex &); +}; + + +typedef SyncGuard MutexGuard; + + +class SemaphoreImplBase +{ +protected: + ~SemaphoreImplBase (); +}; + + +class LOG4CPLUS_EXPORT Semaphore +{ +public: + Semaphore (unsigned max, unsigned initial); + ~Semaphore (); + + void lock () const; + void unlock () const; + +private: + SemaphoreImplBase * sem; + + Semaphore (Semaphore const &); + Semaphore & operator = (Semaphore const &); +}; + + +typedef SyncGuard SemaphoreGuard; + + +class FairMutexImplBase +{ +protected: + ~FairMutexImplBase (); +}; + + +class LOG4CPLUS_EXPORT FairMutex +{ +public: + FairMutex (); + ~FairMutex (); + + void lock () const; + void unlock () const; + +private: + FairMutexImplBase * mtx; + + FairMutex (FairMutex const &); + FairMutex & operator = (FairMutex &); +}; + + +typedef SyncGuard FairMutexGuard; + + +class ManualResetEventImplBase +{ +protected: + ~ManualResetEventImplBase (); +}; + + +class LOG4CPLUS_EXPORT ManualResetEvent +{ +public: + ManualResetEvent (bool = false); + ~ManualResetEvent (); + + void signal () const; + void wait () const; + bool timed_wait (unsigned long msec) const; + void reset () const; + +private: + ManualResetEventImplBase * ev; + + ManualResetEvent (ManualResetEvent const &); + ManualResetEvent & operator = (ManualResetEvent const &); +}; + + +class SharedMutexImplBase +{ +protected: + ~SharedMutexImplBase (); +}; + + +template +class SyncGuardFunc +{ +public: + SyncGuardFunc (SP const &); + ~SyncGuardFunc (); + + void lock (); + void unlock (); + void attach (SP const &); + void detach (); + +private: + SP const * sp; + + SyncGuardFunc (SyncGuardFunc const &); + SyncGuardFunc & operator = (SyncGuardFunc const &); +}; + + +class LOG4CPLUS_EXPORT SharedMutex +{ +public: + SharedMutex (); + ~SharedMutex (); + + void rdlock () const; + void rdunlock () const; + + void wrlock () const; + void wrunlock () const; + +private: + SharedMutexImplBase * sm; + + SharedMutex (SharedMutex const &); + SharedMutex & operator = (SharedMutex const &); +}; + + +typedef SyncGuardFunc SharedMutexReaderGuard; + + +typedef SyncGuardFunc SharedMutexWriterGuard; + + +// +// +// + +template +inline +SyncGuard::SyncGuard () + : sp (0) +{ } + + +template +inline +SyncGuard::SyncGuard (SP const & m) + : sp (&m) +{ + sp->lock (); +} + + +template +inline +SyncGuard::~SyncGuard () +{ + if (sp) + sp->unlock (); +} + + +template +inline +void +SyncGuard::lock () +{ + sp->lock (); +} + + +template +inline +void +SyncGuard::unlock () +{ + sp->unlock (); +} + + +template +inline +void +SyncGuard::attach (SP const & m) +{ + sp = &m; +} + + +template +inline +void +SyncGuard::attach_and_lock (SP const & m) +{ + attach (m); + try + { + lock(); + } + catch (...) + { + detach (); + throw; + } +} + + +template +inline +void +SyncGuard::detach () +{ + sp = 0; +} + + +// +// +// + +template +inline +SyncGuardFunc::SyncGuardFunc (SP const & m) + : sp (&m) +{ + (sp->*lock_func) (); +} + + +template +inline +SyncGuardFunc::~SyncGuardFunc () +{ + if (sp) + (sp->*unlock_func) (); +} + + +template +inline +void +SyncGuardFunc::lock () +{ + (sp->*lock_func) (); +} + + +template +inline +void +SyncGuardFunc::unlock () +{ + (sp->*unlock_func) (); +} + + +template +inline +void +SyncGuardFunc::attach (SP const & m) +{ + sp = &m; +} + + +template +inline +void +SyncGuardFunc::detach () +{ + sp = 0; +} + + +} } // namespace log4cplus { namespace thread { + + +#endif // LOG4CPLUS_THREAD_SYNCPRIMS_H diff --git a/src/nar/resources/noarch/include/log4cplus/thread/threads.h b/src/nar/resources/noarch/include/log4cplus/thread/threads.h new file mode 100644 index 0000000..dbd152c --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/thread/threads.h @@ -0,0 +1,94 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: threads.h +// Created: 6/2001 +// Author: Tad E. Smith +// +// +// Copyright 2001-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_THREADS_HEADER_ +#define LOG4CPLUS_THREADS_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + + +namespace log4cplus { namespace thread { + + +LOG4CPLUS_EXPORT log4cplus::tstring const & getCurrentThreadName(); +LOG4CPLUS_EXPORT log4cplus::tstring const & getCurrentThreadName2(); +LOG4CPLUS_EXPORT void yield(); +LOG4CPLUS_EXPORT void blockAllSignals(); + + +#ifndef LOG4CPLUS_SINGLE_THREADED + +class ThreadImplBase + : public virtual log4cplus::helpers::SharedObject +{ +protected: + virtual ~ThreadImplBase (); +}; + + +/** + * There are many cross-platform C++ Threading libraries. The goal of + * this class is not to replace (or match in functionality) those + * libraries. The goal of this class is to provide a simple Threading + * class with basic functionality. + */ +class LOG4CPLUS_EXPORT AbstractThread + : public virtual log4cplus::helpers::SharedObject +{ +public: + AbstractThread(); + bool isRunning() const; + virtual void start(); + void join () const; + virtual void run() = 0; + +protected: + // Force objects to be constructed on the heap + virtual ~AbstractThread(); + +private: + helpers::SharedObjectPtr thread; + + // Disallow copying of instances of this class. + AbstractThread(const AbstractThread&); + AbstractThread& operator=(const AbstractThread&); +}; + +typedef helpers::SharedObjectPtr AbstractThreadPtr; + + +#endif // LOG4CPLUS_SINGLE_THREADED + + +} } // namespace log4cplus { namespace thread { + + +#endif // LOG4CPLUS_THREADS_HEADER_ + diff --git a/src/nar/resources/noarch/include/log4cplus/tracelogger.h b/src/nar/resources/noarch/include/log4cplus/tracelogger.h new file mode 100644 index 0000000..a056ccd --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/tracelogger.h @@ -0,0 +1,79 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: tracelogger.h +// Created: 1/2009 +// Author: Vaclav Haisman +// +// +// Copyright 2009-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_TRACELOGGER_H +#define LOG4CPLUS_TRACELOGGER_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include + + +namespace log4cplus +{ + + +/** + * This class is used to produce "Trace" logging. When an instance of + * this class is created, it will log a "ENTER: " + msg + * log message if TRACE_LOG_LEVEL is enabled for logger. + * When an instance of this class is destroyed, it will log a + * "ENTER: " + msg log message if TRACE_LOG_LEVEL is enabled + * for logger. + *

+ * @see LOG4CPLUS_TRACE + */ +class TraceLogger +{ +public: + TraceLogger(const Logger& l, const log4cplus::tstring& _msg, + const char* _file=NULL, int _line=-1) + : logger(l), msg(_msg), file(_file), line(_line) + { if(logger.isEnabledFor(TRACE_LOG_LEVEL)) + logger.forcedLog(TRACE_LOG_LEVEL, LOG4CPLUS_TEXT("ENTER: ") + msg, file, line); + } + + ~TraceLogger() + { if(logger.isEnabledFor(TRACE_LOG_LEVEL)) + logger.forcedLog(TRACE_LOG_LEVEL, LOG4CPLUS_TEXT("EXIT: ") + msg, file, line); + } + +private: + TraceLogger (TraceLogger const &); + TraceLogger & operator = (TraceLogger const &); + + Logger logger; + log4cplus::tstring msg; + const char* file; + int line; +}; + + +} // log4cplus + + +#endif // LOG4CPLUS_TRACELOGGER_H diff --git a/src/nar/resources/noarch/include/log4cplus/tstring.h b/src/nar/resources/noarch/include/log4cplus/tstring.h new file mode 100644 index 0000000..587aaa1 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/tstring.h @@ -0,0 +1,134 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: tstring.h +// Created: 4/2003 +// Author: Tad E. Smith +// +// +// Copyright 2003-2013 Tad E. Smith +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_TSTRING_HEADER_ +#define LOG4CPLUS_TSTRING_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#include +#include + +namespace log4cplus +{ + +typedef std::basic_string tstring; + + +namespace helpers +{ + +inline +std::string +tostring (char const * str) +{ + return std::string (str); +} + +inline +std::string +tostring (std::string const & str) +{ + return str; +} + +inline +std::string const & +tostring (std::string & str) +{ + return str; +} + +#ifdef LOG4CPLUS_HAVE_RVALUE_REFS +inline +std::string +tostring (std::string && str) +{ + return std::move (str); +} + +#endif + + + +inline +std::wstring +towstring (wchar_t const * str) +{ + return std::wstring (str); +} + +inline +std::wstring +towstring (std::wstring const & str) +{ + return str; +} + +inline +std::wstring const & +towstring (std::wstring & str) +{ + return str; +} + +#ifdef LOG4CPLUS_HAVE_RVALUE_REFS +inline +std::wstring +towstring (std::wstring && str) +{ + return std::move (str); +} + +#endif + +LOG4CPLUS_EXPORT std::string tostring(const std::wstring&); +LOG4CPLUS_EXPORT std::string tostring(wchar_t const *); + +LOG4CPLUS_EXPORT std::wstring towstring(const std::string&); +LOG4CPLUS_EXPORT std::wstring towstring(char const *); + +} // namespace helpers + +#ifdef UNICODE + +#define LOG4CPLUS_C_STR_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING) +#define LOG4CPLUS_STRING_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING) +#define LOG4CPLUS_TSTRING_TO_STRING(STRING) log4cplus::helpers::tostring(STRING) + +#else // UNICODE + +#define LOG4CPLUS_C_STR_TO_TSTRING(STRING) std::string(STRING) +#define LOG4CPLUS_STRING_TO_TSTRING(STRING) STRING +#define LOG4CPLUS_TSTRING_TO_STRING(STRING) STRING + +#endif // UNICODE + +} // namespace log4cplus + + +#endif // LOG4CPLUS_TSTRING_HEADER_ diff --git a/src/nar/resources/noarch/include/log4cplus/version.h b/src/nar/resources/noarch/include/log4cplus/version.h new file mode 100644 index 0000000..a5485dd --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/version.h @@ -0,0 +1,53 @@ +// -*- C++ -*- +// Copyright (C) 2010-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#if ! defined (LOG4CPLUS_VERSION_H) +#define LOG4CPLUS_VERSION_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#define LOG4CPLUS_MAKE_VERSION(major, minor, point) \ + (major * 1000 * 1000u + minor * 1000u + point) + +#define LOG4CPLUS_MAKE_VERSION_STR(major, minor, point) \ + #major "." #minor "." #point + +#define LOG4CPLUS_VERSION LOG4CPLUS_MAKE_VERSION(1, 1, 1) +#define LOG4CPLUS_VERSION_STR LOG4CPLUS_MAKE_VERSION_STR(1, 1, 1) + + +namespace log4cplus +{ + +extern LOG4CPLUS_EXPORT unsigned const version; +extern LOG4CPLUS_EXPORT char const versionStr[]; + +} + +#endif diff --git a/src/nar/resources/noarch/include/log4cplus/win32consoleappender.h b/src/nar/resources/noarch/include/log4cplus/win32consoleappender.h new file mode 100644 index 0000000..c98eb55 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/win32consoleappender.h @@ -0,0 +1,93 @@ +// -*- C++ -*- +// Copyright (C) 2009-2013, Vaclav Haisman. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modifica- +// tion, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- +// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef LOG4CPLUS_WIN32CONSOLEAPPENDER_H +#define LOG4CPLUS_WIN32CONSOLEAPPENDER_H + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined(_WIN32) && defined (LOG4CPLUS_HAVE_WIN32_CONSOLE) + +#include + + +namespace log4cplus +{ + + /** + * Prints events to Win32 console. + * + *

Properties

+ *
+ *
AllocConsole
+ *
This boolean property specifies whether or not this appender + * will try to allocate new console using the + * AllocConsole() Win32 function.
+ * + *
logToStdErr
+ *
When it is set true, the output will be into + * STD_ERROR_HANDLE instead of STD_OUTPUT_HANDLE. + *
+ * + *
TextColor
+ *
See MSDN documentation for + * + * Character Attributes. + *
+ */ + class LOG4CPLUS_EXPORT Win32ConsoleAppender + : public Appender + { + public: + explicit Win32ConsoleAppender (bool allocConsole = true, + bool logToStdErr = false, unsigned int textColor = 0); + Win32ConsoleAppender (helpers::Properties const & properties); + virtual ~Win32ConsoleAppender (); + + virtual void close (); + + protected: + virtual void append (spi::InternalLoggingEvent const &); + + void write_handle (void *, tchar const *, std::size_t); + void write_console (void *, tchar const *, std::size_t); + + bool alloc_console; + bool log_to_std_err; + unsigned int text_color; + + private: + Win32ConsoleAppender (Win32ConsoleAppender const &); + Win32ConsoleAppender & operator = (Win32ConsoleAppender const &); + }; + +} // namespace log4cplus + +#endif + +#endif // LOG4CPLUS_WIN32CONSOLEAPPENDER_H diff --git a/src/nar/resources/noarch/include/log4cplus/win32debugappender.h b/src/nar/resources/noarch/include/log4cplus/win32debugappender.h new file mode 100644 index 0000000..50059d4 --- /dev/null +++ b/src/nar/resources/noarch/include/log4cplus/win32debugappender.h @@ -0,0 +1,69 @@ +// -*- C++ -*- +// Module: Log4CPLUS +// File: win32debugappender.h +// Created: 12/2003 +// Author: Eduardo Francos, Odalio SARL +// +// +// Copyright 2003-2013 Odalio SARL +// +// Licensed 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 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** @file */ + +#ifndef LOG4CPLUS_WIN32DEBUG_APPENDER_HEADER_ +#define LOG4CPLUS_WIN32DEBUG_APPENDER_HEADER_ + +#include + +#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) +#pragma once +#endif + +#if defined (LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING) + +#include + + +namespace log4cplus { + + /** + * Prints log events using OutputDebugString(). + */ + class LOG4CPLUS_EXPORT Win32DebugAppender + : public Appender + { + public: + // Ctors + Win32DebugAppender(); + Win32DebugAppender(const log4cplus::helpers::Properties& properties); + + // Dtor + virtual ~Win32DebugAppender(); + + // Methods + virtual void close(); + + protected: + virtual void append(const log4cplus::spi::InternalLoggingEvent& event); + + private: + // Disallow copying of instances of this class + Win32DebugAppender(const Win32DebugAppender&); + Win32DebugAppender& operator=(const Win32DebugAppender&); + }; + +} // end namespace log4cplus + +#endif // LOG4CPLUS_HAVE_OUTPUTDEBUGSTRING +#endif // LOG4CPLUS_WIN32DEBUG_APPENDER_HEADER_