27 lines
736 B
C++
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));
|
|
} |