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

📄 logger.h

📁 一个开源的Flash 播放器,可以在Windows/Linux 上运行
💻 H
字号:
// logger.h	-- Thatcher Ulrich <tu@tulrich.com> 2006

// This source code has been donated to the Public Domain.  Do
// whatever you want with it.

// Helpers for logging messages & errors.


#ifndef BASE_LOGGER_H
#define BASE_LOGGER_H


namespace logger
{
	// Log to stdout/stderr.
	void set_standard_log_handlers();

	// Toggle this to enable verbose logging by the standard log
	// handlers.
	extern bool FLAG_verbose_log;

	// Use this to register your own log handler.  If you don't
	// register a log handler, the logs don't go anywhere.
	enum log_type {
		VERBOSE,
		NORMAL,
		ERROR,
	};
	void	register_log_callback(void (*callback)(log_type e, const char* message));


	// gcc has some nice printf arg checking stuff.
#ifdef __GNUC__
	#define ATTRCHECK __attribute__((format (printf, 1, 2)))
#else
	#define ATTRCHECK
#endif
	
	// These are the logging functions.  Printf-style interfaces.

	// Verbose log.
	void	vmsg(const char* fmt, ...) ATTRCHECK;
	// Normal log.
	void	msg(const char* fmt, ...) ATTRCHECK;
	// Error log.
	void	error(const char* fmt, ...) ATTRCHECK;
}

// Shorter aliases for the logging functions.  TODO add __FILE__, __LINE__ etc.
#define LOG logger::msg
#define VLOG logger::vmsg
#define LOGERROR logger::error


#endif // BASE_LOGGER_H


// Local Variables:
// mode: C++
// c-basic-offset: 8 
// tab-width: 8
// indent-tabs-mode: t
// End:

⌨️ 快捷键说明

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