File Scanner 1.0.0
A high-performance C++ malicious file scanner.
Loading...
Searching...
No Matches
file_logger.h
Go to the documentation of this file.
1#ifndef SRC_SCANNER_LIB_FILE_LOGGER_H_
2#define SRC_SCANNER_LIB_FILE_LOGGER_H_
3
4#include <filesystem>
5#include <fstream>
6#include <mutex>
7#include <string>
8
10
11namespace scanner {
12
22class FileLogger final : public ILogger {
23public:
29 explicit FileLogger(const std::filesystem::path& log_path);
30
37 void LogDetection(const std::filesystem::path& path, const std::string& hash,
38 const std::string& verdict) override;
39
40private:
41 std::ofstream log_stream_;
42 std::mutex mutex_;
43};
44
45} // namespace scanner
46
47#endif // SRC_SCANNER_LIB_FILE_LOGGER_H_
An implementation of ILogger that writes detections to a file.
Definition file_logger.h:22
std::ofstream log_stream_
Definition file_logger.h:41
std::mutex mutex_
Definition file_logger.h:42
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.
Definition file_logger.cpp:17
Defines the contract for a component that logs malicious detections.
Definition interfaces.h:64
Definition domain.h:12