File Scanner 1.0.0
A high-performance C++ malicious file scanner.
|
An implementation of ILogger that writes detections to a file. More...
#include <file_logger.h>
Public Member Functions | |
FileLogger (const std::filesystem::path &log_path) | |
Constructs a FileLogger and opens the specified log file. | |
void | LogDetection (const std::filesystem::path &path, const std::string &hash, const std::string &verdict) override |
Logs a malicious file detection to the file in a thread-safe manner. | |
![]() | |
virtual | ~ILogger ()=default |
Private Attributes | |
std::ofstream | log_stream_ |
std::mutex | mutex_ |
An implementation of ILogger that writes detections to a file.
This class is thread-safe. It uses a std::mutex to synchronize access to the output file stream, ensuring that log messages from concurrent threads are not interleaved or corrupted. The file is opened upon construction and closed upon destruction.
|
explicit |
Constructs a FileLogger and opens the specified log file.
log_path | The path to the log file. |
std::runtime_error | if the file cannot be opened for writing. |
|
overridevirtual |
Logs a malicious file detection to the file in a thread-safe manner.
path | The path to the detected file. |
hash | The calculated hash of the file. |
verdict | The verdict from the hash database. |
Implements scanner::ILogger.
|
private |
|
private |