Files
Training-Team2-Zenvy-Jan26/Trenser.Zenvy/Trenser.Zenvy/services/LogService.cpp
T
2026-04-17 12:01:48 +05:30

27 lines
736 B
C++

/*
* File: Log.cpp
* Description: Handle operations related to logging
* Author: Trenser
* Created: 01-Apr-2026
*/
#include "LogService.h"
#include "Log.h"
#include "Factory.h"
#include "DataStore.h"
/*
* Function: log
* Description: Creates a new log entry with the given message, assigns a timestamp,
* and stores it in the DataStore.
* Parameters:
* message - string containing the log message to be recorded
* Returns:
* void - no return value
*/
void LogService::log(const std::string& message)
{
DataStore& dataStore = DataStore::getInstance();
logMap& logs = dataStore.getLogs();
Log* log = Factory::getObject<Log>(message);
logs.emplace(std::make_pair(log->getTimestamp(), log));
}