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

#include <ConsoleLoggerFactory.h>

Inheritance diagram for pulsar::ConsoleLoggerFactory:
pulsar::LoggerFactory

Public Member Functions

 ConsoleLoggerFactory (Logger::Level level=Logger::LEVEL_INFO)
 
LoggergetLogger (const std::string &fileName) override
 

Detailed Description

The default LoggerFactory of Client if USE_LOG4CXX macro was not defined during compilation.

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 ...

It uses std::cout to prints logs to standard output. You can use this factory class to change your log level simply.

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

Member Function Documentation

◆ getLogger()

Logger * pulsar::ConsoleLoggerFactory::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: