EZLog
载入中...
搜索中...
未找到
Logger.h 文件参考
#include <QDebug>
#include <QString>
#include <QSettings>
#include <QTextStream>
#include <QDateTime>
#include <iostream>
#include <memory>
#include <atomic>
#include <mutex>
#include <functional>

浏览源代码.

class  EZLog::Lib
 日志库 更多...
 
struct  EZLog::null_mutex
 空mutex 更多...
 
struct  EZLog::null_atomic< T >
 空atomic 更多...
 
class  EZLog::Logger
 日志类 更多...
 

命名空间

namespace  spdlog
 spdlog前向声明
 
namespace  EZLog
 EZlog命名空间,避免命名冲突
 

宏定义

#define LOGGER_EXPORT   __declspec(dllimport)
 
#define LOGGER_SINGLE_THREAD
 单线程优化,如果程序为单线程建议开启。
 
#define LOGGER_NO_DEBUG_OUTPUT
 关闭Debug输出。
 
#define LOG_INIT(name)   Logger::Initialize(#name)
 日志初始化, 必须在使用日志系统前初始化(例如 LogInit(MyProject))
 
#define TAKE_OVER_QDEBUG   Logger::InstallMessageHandler()
 接管qDebug输出。
 
#define lDebug   Logger::Debug().output
 预定义的宏,可同时在控制台和日志文件中输出内容。使用方法和 qDebug 相同(例如 lDebug() << "something";)
 
#define LogDebug   Logger::Debug()
 预定义的宏,便于使用Logger::Debug方法
 
#define LogInfo   Logger::Info()
 预定义的宏,便于使用Logger::Info方法
 
#define LogWarn   Logger::Warn()
 预定义的宏,便于使用Logger::Warn方法
 
#define LogError   Logger::Error()
 预定义的宏,便于使用Logger::Error方法
 
#define LogCritical   Logger::Critical()
 预定义的宏,便于使用Logger::Critical方法
 

类型定义

template<typename T >
using EZLog::Atomic = null_atomic< T >
 atomic类型
 
using EZLog::Mutex = null_mutex
 mutex类型
 

变量

LOGGER_EXPORT std::mutex EZLog::real_mutex
 std::mutex类型的mutex,在多线程模式中用于同步
 
LOGGER_EXPORT null_mutex EZLog::fake_mutex
 null_mutex类型的mutex,在单线程模式中用于模拟mutex操作
 

宏定义说明

◆ lDebug

#define lDebug   Logger::Debug().output

预定义的宏,可同时在控制台和日志文件中输出内容。使用方法和 qDebug 相同(例如 lDebug() << "something";)

◆ LOG_INIT

#define LOG_INIT (   name)    Logger::Initialize(#name)

日志初始化, 必须在使用日志系统前初始化(例如 LogInit(MyProject))

参数
name项目名称

◆ LogCritical

#define LogCritical   Logger::Critical()

预定义的宏,便于使用Logger::Critical方法

◆ LogDebug

#define LogDebug   Logger::Debug()

预定义的宏,便于使用Logger::Debug方法

◆ LogError

#define LogError   Logger::Error()

预定义的宏,便于使用Logger::Error方法

◆ LOGGER_EXPORT

#define LOGGER_EXPORT   __declspec(dllimport)

◆ LOGGER_NO_DEBUG_OUTPUT

#define LOGGER_NO_DEBUG_OUTPUT

关闭Debug输出。

◆ LOGGER_SINGLE_THREAD

#define LOGGER_SINGLE_THREAD

单线程优化,如果程序为单线程建议开启。

◆ LogInfo

#define LogInfo   Logger::Info()

预定义的宏,便于使用Logger::Info方法

◆ LogWarn

#define LogWarn   Logger::Warn()

预定义的宏,便于使用Logger::Warn方法

◆ TAKE_OVER_QDEBUG

#define TAKE_OVER_QDEBUG   Logger::InstallMessageHandler()

接管qDebug输出。