outputlog.h

来自「程序开发中写log用的实现代码, C语言代码, 可以不用修改再C++或MFC中使」· C头文件 代码 · 共 45 行

H
45
字号

#ifndef _OUTPUTLOG_H_
#define _OUTPUTLOG_H_

#ifdef __cplusplus
extern "C" 
{
#endif /* __cplusplus */

/*-------------------------------------------------------------------
Includes and variable definitions
-------------------------------------------------------------------*/
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>

typedef unsigned char boolean;
typedef unsigned char byte;

#ifndef PUBLIC
#define PUBLIC
#endif

#define  LOG_INIT(log_path)     InitFile(log_path)
#define  LOG_CLOSE              CloseFile
#define  WRITE_TO_LOG           TIEM_FILE_LINE(__FILE__, __LINE__); WriteToLog
#define  WRITE_TO_LOG_HEX		TIEM_FILE_LINE(__FILE__, __LINE__); WriteToLogHex

/*-------------------------------------------------------------------
Function Prototypes
-------------------------------------------------------------------*/
PUBLIC  void InitFile(const char *pcFilePath);
PUBLIC  void CloseFile(void);
PUBLIC  void TIEM_FILE_LINE(const char *pcFileStr, int nLineNumber);
PUBLIC  boolean WriteToLog(const char *pcFormat, ...);
PUBLIC  boolean WriteToLogHex(const void *pcBuffer, int nSize);
PUBLIC  boolean WriteToLogNone(const char *pcFormat, ...);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* _OUTPUTLOG_H_ */

⌨️ 快捷键说明

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