Improved logging abstraction

This also gets rid of --log-type, since the nested log type isn't
useful in a multi-threaded situation, and nobody cares about the
"pretty" log type.
This commit is contained in:
Eelco Dolstra 2016-04-25 15:26:07 +02:00
parent c879a20850
commit 41633f9f73
29 changed files with 394 additions and 456 deletions

View file

@ -1,49 +1,15 @@
#pragma once
#include "sync.hh"
#include "util.hh"
#include "logging.hh"
namespace nix {
class ProgressBar
class StartProgressBar
{
private:
struct State
{
std::string status;
bool done = false;
std::list<std::string> activities;
};
Sync<State> state;
Logger * prev = 0;
public:
ProgressBar();
~ProgressBar();
void updateStatus(const std::string & s);
void done();
class Activity
{
friend class ProgressBar;
private:
ProgressBar & pb;
std::list<std::string>::iterator it;
Activity(ProgressBar & pb, const FormatOrString & fs);
public:
~Activity();
};
Activity startActivity(const FormatOrString & fs);
private:
void render(State & state_);
StartProgressBar();
~StartProgressBar();
};
}