3 Star 2 Fork 5

张远浩/call_demo_server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Log.h 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
zhangyuanhao 提交于 2015-08-26 23:44 . [ADD] 增加测试客户端
/*================================================================
* 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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bluefoxah/call_demo_server.git
git@gitee.com:bluefoxah/call_demo_server.git
bluefoxah
call_demo_server
call_demo_server
master

搜索帮助