openMSX
StdioMessages.cc
Go to the documentation of this file.
1#include "StdioMessages.hh"
2#include <iostream>
3
4namespace openmsx {
5
6void StdioMessages::log(CliComm::LogLevel level, std::string_view message, float fraction) noexcept
7{
8 auto levelStr = CliComm::getLevelStrings();
9 auto& out = (level == CliComm::INFO) ? std::cout : std::cerr;
10 out << levelStr[level] << ": " << message;
11 if (level == CliComm::PROGRESS && fraction >= 0.0f) {
12 out << "... " << int(100.0f * fraction) << '%';
13 }
14 out << '\n' << std::flush;
15}
16
17void StdioMessages::update(CliComm::UpdateType /*type*/, std::string_view /*machine*/,
18 std::string_view /*name*/, std::string_view /*value*/) noexcept
19{
20 // ignore
21}
22
23} // namespace openmsx
static std::span< const std::string_view, NUM_LEVELS > getLevelStrings()
Definition CliComm.hh:93
void update(CliComm::UpdateType type, std::string_view machine, std::string_view name, std::string_view value) noexcept override
void log(CliComm::LogLevel level, std::string_view message, float fraction) noexcept override
This file implemented 3 utility functions:
Definition Autofire.cc:9