|
Load Balancer Simulation
A simulation of a load balancer with dynamic server scaling in C++
|
Static logger that writes to both console and a log file. More...
#include <Logger.h>
Static Public Member Functions | |
| static bool | init (const std::string &filename) |
| Initialize the logger with an output file. | |
| static void | close () |
| Close the log file. | |
| static void | log (const std::string &message) |
| Write a message to both console and log file. | |
| static bool | isOpen () |
| Check if the log file is currently open. | |
Static Private Member Functions | |
| static std::string | stripAnsi (const std::string &str) |
| Remove ANSI escape sequences from a string. | |
Static Private Attributes | |
| static std::ofstream | logFile_ |
Static logger that writes to both console and a log file.
ANSI color codes are preserved for console output but stripped when writing to the log file.
|
static |
|
static |
Initialize the logger with an output file.
Initialize logger with output file.
| filename | Path to the log file |
Definition at line 13 of file Logger.cpp.
Referenced by main().
|
inlinestatic |
|
static |
Write a message to both console and log file.
Write message to console and log file.
ANSI escape codes are stripped when writing to the file.
| message | The message to log |
Definition at line 36 of file Logger.cpp.
Referenced by LoadBalancer::log(), main(), LoadBalancer::printSummary(), and LoadBalancer::run().
|
staticprivate |
Remove ANSI escape sequences from a string.
Remove ANSI escape sequences from string.
| str | The string to strip |
Definition at line 29 of file Logger.cpp.
Referenced by log().
|
staticprivate |