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

📄 logimpl.h

📁 日志类封装日志类封装日志类封装日志类封装日志类封装日志类封装
💻 H
字号:
/*============================================================================. | Copyright (C) 2006 Gareth Buxton                                           | |----------------------------------------------------------------------------| | LogPlusPlus is free software; you can redistribute it and/or               | | modify it under the terms of the GNU Lesser General Public                 | | License as published by the Free Software Foundation; either               | | version 2.1 of the License, or (at your option) any later version.         | |                                                                            | | LogPlusPlus is distributed in the hope that it will be useful,             | | but WITHOUT ANY WARRANTY; without even the implied warranty of             | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          | | Lesser General Public License for more details.                            | |                                                                            | | You should have received a copy of the GNU Lesser General Public           | | License along with this library; if not, write to the Free Software        | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | '============================================================================*/#ifndef LOGIMPL_H_#define LOGIMPL_H_#include <liblpp/Log.h>#include "LogOutput.h"#include <iostream>#include <string>#include <ctime>#include <map>#include <algorithm>#include <vector>#include <iomanip>//=============================================================================LPP_NAMESPACE_BEGIN//=============================================================================/*============================================================================. | Typedefs                                                                   | '============================================================================*/// User defined log levels in addition to // the builtin ones (debug, info etc...// Note logStreamMap only holds the user// created ones to allow them string key// access to their info streams.typedef std::map<std::string, LogStream*> LogStreamMap;typedef LogStreamMap::iterator LogStreamMapIter;typedef std::map<std::string, Log*> LogMap;class LogImpl: public Log{private:	std::string name;	LogWriter writer;	LogStreamMap logStreamMap;public:	LogImpl(const std::string& name, std::ostream& os);	~LogImpl();	static const LogLevel& checkLogLevel( const LogLevel& logLevel);	static const LogLevel& defaultLogLevel(const LogLevel* logLevel = 0);	static const LogMask& defaultLogMask(const LogMask* logMask = 0);		inline	static LogMap& logMap()	{		static LogMap logMap;		return logMap;	}	/*========================================================================.	 | Dynamic Interface                                                      |	 '========================================================================*/	const std::string& getName() const;	/*------------------------------------------------------------------------.	 | LogOutput Management                                                   |	 '------------------------------------------------------------------------*/	void addOutput(const std::string& name, const LogMask& mask,		std::ostream& os = std::clog);	void setLogMask(const LogMask& mask, ModType modType = REPLACE);	void setLogMaskLevel(const LogLevel& level, ModType modType = REPLACE);	LogMask getLogMask();	void setLogMask(const std::string& name, const LogMask& mask,		ModType modType = REPLACE);	void setLogMaskLevel(const std::string& name, const LogLevel& level,		ModType modType = REPLACE);	LogMask getLogMask(const std::string& name);	void setLogForm(const LogForm* const format);	void setLogForm(const std::string& name, const LogForm* const format);	void delOutput(const std::string& name);			/*------------------------------------------------------------------------.	 | std::ostream Management                                                |	 '------------------------------------------------------------------------*/	void attachOstream(std::ostream& os);	void removeOstream(std::ostream& os);		void attachOstream(const std::string& name, std::ostream& os);	void removeOstream(const std::string& name, std::ostream& os);	/*------------------------------------------------------------------------.	 | LogStream Management                                                   |	 '------------------------------------------------------------------------*/	void addLogStream(const std::string& name,		const LogLevel& level = MAX_LEVEL);	void modLogStream(const std::string& name, const LogLevel& level);	void delLogStream(const std::string& name);		/*------------------------------------------------------------------------.	 | User defined LogStream access                                          |	 '------------------------------------------------------------------------*/	LogStream& to(std::string name);	LogStream& to(std::string name, std::string info);	void setThreadMill(const ThreadMill* threadMill);	void startThread();	void stopThread();	void close();	};	//=============================================================================LPP_NAMESPACE_END//=============================================================================#endif // LOGIMPL_H_

⌨️ 快捷键说明

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