代码拉取完成,页面将自动刷新
/*================================================================
* Copyright (C) 2014 All rights reserved.
*
* 文件名称:Log.h
* 创 建 者:Zhang Yuanhao
* 邮 箱:bluefoxah@gmail.com
* 创建日期:2014年09月10日
* 描 述:
*
#pragma once
================================================================*/
#ifndef __LOG_H__
#define __LOG_H__
#include "ostype.h"
#include "Lock.h"
#include <stdio.h>
#ifndef _WIN32
#include <unistd.h>
#endif
#define DEFAULT_LOG_PATH "log"
#define LOG_FILE_NAME "im.log"
typedef enum
{
LOG_DEBUG = 0,
LOG_INFO,
LOG_WARN,
LOG_ERROR,
LEVEL_COUNT,
} LOG_LEVEL;
#define MAX_LOG_FILE_SIZE 0x8000000 // 128MB
class CLog
{
public:
static CLog* getInstance();
bool Init(const char* pPath = NULL);
virtual ~CLog();
void writeLog(const char* content);
private:
CLog():m_bInited(false) { gethostname(m_szHost,sizeof(m_szHost)); };
bool isSameDay(const time_t t1, const time_t t2);
bool InitLog();
private:
static CLog* m_pInstance;
char m_szPath[128];
FILE* m_pFile;
FILE* m_pFileLocal;
uint32_t m_nFileIndex;
bool m_bInited;
time_t m_lastTime;
char m_szHost[64];
};
void sysLog(const char* fmt, ...);
void init_log(bool bUseLock = false);
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。