Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Logger.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <string>
6#include <string_view>
7#include <vector>
8#include <functional>
9#include <memory>
10
11namespace ph
12{
13
14class Logger final
15{
16public:
17 Logger();
18
19 void log(std::string_view message) const;
20
21 void log(ELogLevel logLevel, std::string_view message) const;
22
23 void log(
24 std::string_view name,
25 ELogLevel logLevel,
26 std::string_view message) const;
27
31 void addLogHandler(LogHandler logHandler);
32
33public:
36
37private:
38 std::vector<LogHandler> m_logHandlers;
39
40 static std::string makeLogString(
41 std::string_view name,
42 ELogLevel logLevel,
43 std::string_view message);
44
45 static bool shouldStdOutPrintWithoutBuffering(ELogLevel logLevel);
46};
47
48}// end namespace ph
Definition Logger.h:15
void log(std::string_view message) const
Definition Logger.cpp:24
static LogHandler makeStdOutLogPrinter()
Definition Logger.cpp:111
static LogHandler makeColoredStdOutLogPrinter()
Definition Logger.cpp:127
void addLogHandler(LogHandler logHandler)
Add a log handler that can deal with log messages. Log handler must be copyable.
Definition Logger.cpp:47
Logger()
Definition Logger.cpp:20
The root for all renderer implementations.
Definition assertion.h:9
std::function< void(ELogLevel logLevel, std::string_view logString)> LogHandler
Definition logger_fwd.h:12
ELogLevel
Definition ELogLevel.h:9