📄 logoutput.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 LOGOUTPUT_H_#define LOGOUTPUT_H_#include <liblpp/Types.h>#include <liblpp/LogMask.h>#include <liblpp/LogForm.h>#include "LogWriter.h"#include <set>#include <string>#include <sstream>//=============================================================================LPP_NAMESPACE_BEGIN//=============================================================================typedef std::set<std::ostream*> OstreamSet;/** * A LogOutput is the final recipient of all Log messages * and makes the decision as to whether or not the message * will be sent to one of the configured ostreams. **/class LogOutput{private: //static Log& log; std::string name; LogMask logMask; OstreamSet ostreamSet; const LogForm* defaultFormat; const LogForm* logForm;public: /** * Construct a new LogOutput. **/ LogOutput(const std::string& name, const LogMask& logMask); virtual ~LogOutput(); /** * Get the name of this LogOutput. * @return The name of this LogOutput. **/ inline const std::string& getName() { return name; } /*------------------------------------------------------------------------. | std::ostream Management | '------------------------------------------------------------------------*/ /** * Attach a std::ostream to this LogOutput. * If the std::ostream already exists * an error message will be * generated on the internal log. * @param os The std::ostream to add to this LogOutput. **/ void attachOstream(std::ostream& os); /** * Remove a std::ostream from this LogOutput. * If the std::ostream is not present * an error message will be * generated on the internal log. * @param os The std::ostream to remove from this LogOutput. **/ void removeOstream(std::ostream& os); /** * Set the LogMask for this LogOutput. * @param logMask The LogMask to set. * @param modType The ModType with which to apply * the LogMask. **/ void setLogMask(const LogMask& logMask, const ModType& modType = REPLACE); /** * Get the LogMask for this LogOutput. * @return The LogMask for this LogOutput. **/ inline LogMask getLogMask() { return logMask; } /** * Write an entry to each std::ostream attached * to this LogOutput. * @param message The LogMessage to write. **/ void write(const LogMessage& message) const; /** * Change the internal LogForm formatting object. * @param format The new LogForm object to use. **/ void setLogForm(const LogForm* const logForm);};//=============================================================================LPP_NAMESPACE_END//=============================================================================#endif /*LOGOUTPUT_H_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -