|
Zappy Server
C++ game server: world, rules, scheduler, network
|
Logging facade: formats [time] [LEVEL] [component] message, filters by level, and forwards to a single sink (typically a CompositeSink).
More...
#include <Logger.hpp>
Collaboration diagram for Logger:Public Member Functions | |
| Logger (LogLevel threshold=LogLevel::Debug) | |
| void | setSink (std::unique_ptr< ILogSink > sink) |
| void | setThreshold (LogLevel threshold) |
| void | debug (std::string_view component, std::string_view msg) |
| void | info (std::string_view component, std::string_view msg) |
| void | warn (std::string_view component, std::string_view msg) |
| void | error (std::string_view component, std::string_view msg) |
Private Member Functions | |
| void | _log (LogLevel level, std::string_view component, std::string_view msg) |
Private Attributes | |
| std::unique_ptr< ILogSink > | _sink |
| LogLevel | _threshold |
Logging facade: formats [time] [LEVEL] [component] message, filters by level, and forwards to a single sink (typically a CompositeSink).
Sink and threshold are injected (Dependency Injection). Messages below the threshold are dropped before formatting.
Definition at line 17 of file Logger.hpp.
|
explicit |
Definition at line 37 of file Logger.cpp.
|
private |
Definition at line 41 of file Logger.cpp.
References _levelName(), _sink, _threshold, and _timestamp().
Referenced by debug(), error(), info(), and warn().
Here is the call graph for this function:
Here is the caller graph for this function:| void Logger::debug | ( | std::string_view | component, |
| std::string_view | msg | ||
| ) |
Definition at line 50 of file Logger.cpp.
Referenced by LogObserver::onBroadcast(), LogObserver::onLineReceived(), LogObserver::onLineSent(), LogObserver::onPlayerInventoryChanged(), LogObserver::onPlayerMoved(), LogObserver::onResourceDropped(), LogObserver::onResourceTaken(), and LogObserver::onTileChanged().
Here is the call graph for this function:
Here is the caller graph for this function:| void Logger::error | ( | std::string_view | component, |
| std::string_view | msg | ||
| ) |
| void Logger::info | ( | std::string_view | component, |
| std::string_view | msg | ||
| ) |
Definition at line 55 of file Logger.cpp.
Referenced by Server::_handleGameOver(), LogObserver::onClientConnected(), LogObserver::onClientDisconnected(), LogObserver::onEggDied(), LogObserver::onEggHatched(), LogObserver::onEggLaid(), LogObserver::onGameEnd(), LogObserver::onIncantationEnd(), LogObserver::onIncantationStart(), LogObserver::onInitialEggSpawned(), LogObserver::onPlayerAdded(), LogObserver::onPlayerEjected(), LogObserver::onPlayerLevelUp(), LogObserver::onPlayerRemoved(), and Server::run().
Here is the call graph for this function:
Here is the caller graph for this function:| void Logger::setSink | ( | std::unique_ptr< ILogSink > | sink | ) |
Definition at line 39 of file Logger.cpp.
References _sink.
Referenced by Server::Server().
Here is the caller graph for this function:
|
inline |
Definition at line 22 of file Logger.hpp.
References _threshold.
| void Logger::warn | ( | std::string_view | component, |
| std::string_view | msg | ||
| ) |
|
private |
Definition at line 32 of file Logger.hpp.
|
private |
Definition at line 33 of file Logger.hpp.
Referenced by _log(), and setThreshold().