⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logger.h

📁 log4cxx 0.10 unix下编译包
💻 H
📖 第 1 页 / 共 5 页
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License.  You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * 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. */#ifndef _LOG4CXX_LOGGER_H#define _LOG4CXX_LOGGER_H#if defined(_MSC_VER)#pragma warning ( push )#pragma warning ( disable: 4231 4251 4275 4786 )#endif#include <log4cxx/helpers/appenderattachableimpl.h>#include <log4cxx/level.h>#include <log4cxx/helpers/pool.h>#include <log4cxx/helpers/mutex.h>#include <log4cxx/spi/location/locationinfo.h>#include <log4cxx/helpers/resourcebundle.h>#include <log4cxx/helpers/messagebuffer.h>namespace log4cxx{    namespace helpers {            class synchronized;    }        namespace spi {        class LoggerRepository;        LOG4CXX_PTR_DEF(LoggerRepository);        class LoggerFactory;        LOG4CXX_PTR_DEF(LoggerFactory);    }    class Logger;    /** smart pointer to a Logger class */    LOG4CXX_PTR_DEF(Logger);    LOG4CXX_LIST_DEF(LoggerList, LoggerPtr);    /**    This is the central class in the log4cxx package. Most logging    operations, except configuration, are done through this class.    */    class LOG4CXX_EXPORT Logger :                public virtual log4cxx::spi::AppenderAttachable,                public virtual helpers::ObjectImpl    {    public:        DECLARE_ABSTRACT_LOG4CXX_OBJECT(Logger)        BEGIN_LOG4CXX_CAST_MAP()                LOG4CXX_CAST_ENTRY(Logger)                LOG4CXX_CAST_ENTRY(spi::AppenderAttachable)        END_LOG4CXX_CAST_MAP()            private:        /**         *   Reference to memory pool.         */        helpers::Pool* pool;    protected:        /**        The name of this logger.        */        LogString name;        /**        The assigned level of this logger.  The        <code>level</code> variable need not be assigned a value in        which case it is inherited form the hierarchy.  */        LevelPtr level;        /**        The parent of this logger. All loggers have at least one        ancestor which is the root logger. */        LoggerPtr parent;        /** The resourceBundle for localized messages.        @see setResourceBundle, getResourceBundle        */        helpers::ResourceBundlePtr resourceBundle;        // Loggers need to know what Hierarchy they are in        log4cxx::spi::LoggerRepository * repository;        helpers::AppenderAttachableImplPtr aai;                /** Additivity is set to true by default, that is children inherit                        the appenders of their ancestors by default. If this variable is                        set to <code>false</code> 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 <code>false</code> too. See                        the user manual for more details. */                bool additive;    protected:        friend class DefaultLoggerFactory;        /**        This constructor created a new <code>logger</code> instance and        sets its name.        <p>It is intended to be used by sub-classes only. You should not        create categories directly.        @param pool lifetime of pool must be longer than logger.        @param name The name of the logger.        */        Logger(log4cxx::helpers::Pool& pool, const LogString& name);    public:        ~Logger();        void addRef() const;        void releaseRef() const;		/*十六进制报文输出管理*/		void Log_Hexdump(::log4cxx::helpers::MessageBuffer & oss, const char *buffer, size_t size, const char *text = 0 );		void Log_Hexdump(::log4cxx::helpers::MessageBuffer & oss, const unsigned char *buffer, size_t size, const char *text = 0 );		int Format_hexdump (const char *buffer,  size_t size, char *obuf, size_t obuf_sz);        /**        Add <code>newAppender</code> to the list of appenders of this        Logger instance.        <p>If <code>newAppender</code> is already in the list of        appenders, then it won't be added again.        */        virtual void addAppender(const AppenderPtr& newAppender);         /**        Call the appenders in the hierrachy starting at        <code>this</code>.  If no appenders could be found, emit a        warning.        <p>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.          @param p memory pool for any allocations needed to process request.        */        void callAppenders(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) const;        /**        Close all attached appenders implementing the AppenderAttachable        interface.        */        void closeNestedAppenders();        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        @param location location of source of logging request.        */        void debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        */        void debug(const std::string& msg) const;#if LOG4CXX_WCHAR_T_API        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        @param location location of source of logging request.        */        void debug(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const;        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        */        void debug(const std::wstring& msg) const;#endif#if LOG4CXX_UNICHAR_API        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        @param location location of source of logging request.        */        void debug(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const;        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        */        void debug(const std::basic_string<UniChar>& msg) const;#endif#if LOG4CXX_CFSTRING_API        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        @param location location of source of logging request.        */        void debug(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const;        /**        Log a message string with the DEBUG level.        <p>This method first checks if this logger is <code>DEBUG</code>        enabled by comparing the level of this logger with the        DEBUG level. If this logger is        <code>DEBUG</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        */        void debug(const CFStringRef& msg) const;#endif        /**        Log a message string with the ERROR level.        <p>This method first checks if this logger is <code>ERROR</code>        enabled by comparing the level of this logger with the        ERROR level. If this logger is        <code>ERROR</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        @param location location of source of logging request.        */        void error(const std::string& msg, const log4cxx::spi::LocationInfo& location) const;        /**        Log a message string with the ERROR level.        <p>This method first checks if this logger is <code>ERROR</code>        enabled by comparing the level of this logger with the        ERROR level. If this logger is        <code>ERROR</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        */        void error(const std::string& msg) const;#if LOG4CXX_WCHAR_T_API        /**        Log a message string with the ERROR level.        <p>This method first checks if this logger is <code>ERROR</code>        enabled by comparing the level of this logger with the        ERROR level. If this logger is        <code>ERROR</code> enabled, it proceeds to call all the        registered appenders in this logger and also higher in the        hierarchy depending on the value of the additivity flag.        @param msg the message string to log.        */        void error(const std::wstring& msg) const;        /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -