mirror of
https://github.com/NixOS/nix
synced 2025-06-27 16:51:15 +02:00
Logger: Add method for writing to stdout
Usually this just writes to stdout, but for ProgressBar, we need to
clear the current line, write the line to stdout, and then redraw the
progress bar.
(cherry picked from commit 696c026006
)
This commit is contained in:
parent
fcd048a526
commit
67a5941472
3 changed files with 29 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <atomic>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
@ -24,6 +25,11 @@ void Logger::warn(const std::string & msg)
|
|||
log(lvlWarn, ANSI_YELLOW "warning:" ANSI_NORMAL " " + msg);
|
||||
}
|
||||
|
||||
void Logger::writeToStdout(std::string_view s)
|
||||
{
|
||||
std::cout << s << "\n";
|
||||
}
|
||||
|
||||
class SimpleLogger : public Logger
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue