pulsar-client-cpp
Loading...
Searching...
No Matches
Public Member Functions | List of all members
pulsar::FileLoggerFactory Class Reference

#include <FileLoggerFactory.h>

Inheritance diagram for pulsar::FileLoggerFactory:
pulsar::LoggerFactory

Public Member Functions

 FileLoggerFactory (Logger::Level level, const std::string &logFilePath)
 
pulsar::LoggergetLogger (const std::string &filename) override
 

Detailed Description

A logger factory that is appending logs to a single file.

The log format is "yyyy-MM-dd HH:mm:ss,SSS Z <level> <thread-id> <file>:<line> | <msg>", like

2021-03-24 17:35:46,571 +0800 INFO [0x10a951e00] ConnectionPool:85 | Created connection for ...

Example:

++
#include <pulsar/FileLoggerFactory.h>
conf.setLogger(new FileLoggerFactory(Logger::LEVEL_DEBUG, "pulsar-client-cpp.log"));
Client client("pulsar://localhost:6650", conf);
Definition ClientConfiguration.h:29
ClientConfiguration & setLogger(LoggerFactory *loggerFactory)
Definition Client.h:49
Definition FileLoggerFactory.h:47

Constructor & Destructor Documentation

◆ FileLoggerFactory()

pulsar::FileLoggerFactory::FileLoggerFactory ( Logger::Level  level,
const std::string &  logFilePath 
)

Create a FileLoggerFactory instance.

Parameters
levelthe log level
logFilePaththe log file's path

Member Function Documentation

◆ getLogger()

pulsar::Logger * pulsar::FileLoggerFactory::getLogger ( const std::string &  fileName)
overridevirtual

Create a Logger that is created from the filename

Parameters
fileNamethe filename that is used to construct the Logger
Returns
a pointer to the created Logger instance
Note
the pointer must be allocated with the new keyword in C++

Implements pulsar::LoggerFactory.


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