nllayout.h

来自「一些unix下的c/c++的util包」· C头文件 代码 · 共 54 行

H
54
字号
/**
 * 日志布局抽象基类
 * @file NLLayout.h
 * @date 2006年11月9日
 * @author 周志武
 * @version 1.0.0: 初始版本
 **/

 
#ifndef _NLLAYOUT_H_
#define _NLLAYOUT_H_
#include <iosfwd>
#include <string>

namespace nlkit
{
    class NLEvent;
	/**
	Extend this abstract class to create your own log layout format.
	*/
	class NLLayout 
	{
	public:

		virtual ~NLLayout() {}

		/**
		Implement this method to create your own layout format.
		*/
		virtual void format(std::ostream& output, const NLEvent& event) const = 0;

		/**
		Returns the content type output by this layout. The base class
		returns "text/plain".
		*/
		virtual std::string getContentType() const { return ("text/plain"); }

		/**
		Append the header for the layout format. The base class does
		nothing.
		*/
		virtual void appendHeader(std::ostream& output) {}

		/**
		Append the footer for the layout format. The base class does
		nothing.
		*/
		virtual void appendFooter(std::ostream& output) {}
	};
} 

#endif // _NLLAYOUT_H_

⌨️ 快捷键说明

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