FIX 4.0 Demo 1.0
Loading...
Searching...
No Matches
fix40::Logger Class Reference

线程安全的日志输出器(单例模式) More...

#include <logger.hpp>

Collaboration diagram for fix40::Logger:
Collaboration graph

Classes

class  LogStream
 日志流对象,支持流式输出 More...
 

Public Member Functions

void setEnabled (bool enabled)
 启用或禁用日志输出
 
bool isEnabled () const
 检查日志是否启用
 
LogStream log ()
 创建日志流对象
 

Static Public Member Functions

static Loggerinstance ()
 获取 Logger 单例实例
 

Detailed Description

线程安全的日志输出器(单例模式)

确保每条日志完整输出,不会被其他线程的输出打断。 使用 POSIX write() 系统调用保证原子性写入。

使用示例
LOG() << "Connection established, fd=" << fd;
LOG() << "Received message: " << msg;
#define LOG()
日志输出宏
Definition logger.hpp:138
Note
日志会自动在末尾添加换行符

Member Function Documentation

◆ instance()

static Logger & fix40::Logger::instance ( )
inlinestatic

获取 Logger 单例实例

Returns
Logger& 单例引用
Here is the caller graph for this function:

◆ isEnabled()

bool fix40::Logger::isEnabled ( ) const
inline

检查日志是否启用

Returns
bool 是否启用

◆ log()

LogStream fix40::Logger::log ( )
inline

创建日志流对象

Returns
LogStream 日志流对象

◆ setEnabled()

void fix40::Logger::setEnabled ( bool  enabled)
inline

启用或禁用日志输出

Parameters
enabledtrue 启用,false 禁用
Here is the caller graph for this function:

The documentation for this class was generated from the following file: