From 25d6d41af95cc2a2db3ba2651e5d784413c7058f Mon Sep 17 00:00:00 2001 From: bd Date: Mon, 10 Mar 2025 20:55:21 -0400 Subject: before error with catch crashing with global singleton logger --- src/cli/cli.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/cli') diff --git a/src/cli/cli.cc b/src/cli/cli.cc index a5706fb..2126798 100644 --- a/src/cli/cli.cc +++ b/src/cli/cli.cc @@ -3,9 +3,7 @@ #include "definitions.h" #include "dram.h" #include "response.h" -#include -#include -#include +#include Cli::Cli() { @@ -95,10 +93,7 @@ void Cli::help() << " q - Quits the program\n"; } -void Cli::load(int memory_address) -{ - std::cout << "Loading data from memory address " << memory_address; -} +void Cli::load(int memory_address) { ; } void Cli::store(Accessor accessor, int data, int address) { @@ -142,11 +137,12 @@ void Cli::run() { std::cout << "Memory Command Processor Started. Type 'h' for a list of " "commands.\n"; - std::string input; + while (true) { std::cout << "> "; std::getline(std::cin, input); + std::istringstream iss(input); std::vector tokens; std::string word; @@ -168,15 +164,16 @@ void Cli::run() if (it != commands.end()) { it->second(tokens); } else { - std::cout - << "Unknown command. Type 'help' for available commands.\n"; + std::cout << "Unknown command: '" << command + << "'. Type 'help' for available commands.\n"; } } } void Cli::initialize() { - std::cout << "Resetting memory configuration.\n"; + Logger *global_log = Logger::getInstance(); + global_log->log(INFO, "Resetting memory configuration.\n"); if (this->cache == nullptr) delete this->cache; Dram *d = new Dram(MEM_SIZE, MEM_DELAY); -- cgit v1.2.3