Skip to content

Commit 0dbc7c2

Browse files
committed
Executor comments/organization.
1 parent 7780a4f commit 0dbc7c2

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

console/executor.hpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,33 +38,20 @@ class executor
3838
public:
3939
DELETE_COPY(executor);
4040

41+
// Construct.
4142
executor(parser& metadata, std::istream&, std::ostream& output,
4243
std::ostream& error);
4344

45+
// Called from main.
4446
bool dispatch();
4547

4648
private:
47-
void logger(const auto& message) const
48-
{
49-
if (log_.stopped())
50-
output_ << message << std::endl;
51-
else
52-
log_.write(network::levels::application) << message << std::endl;
53-
}
54-
55-
void stopper(const auto& message)
56-
{
57-
capture_.stop();
58-
log_.stop(message, network::levels::application);
59-
stopped_.get_future().wait();
60-
}
61-
62-
// Stop signal.
49+
// Executor (static).
6350
static void initialize_stop();
6451
static void stop(const system::code& ec);
6552
static void handle_stop(int code);
6653

67-
// Event handlers.
54+
// Executor.
6855
void handle_started(const system::code& ec);
6956
void handle_subscribed(const system::code& ec, size_t key);
7057
void handle_running(const system::code& ec);
@@ -136,8 +123,11 @@ class executor
136123
system::ofstream create_event_sink() const;
137124
void subscribe_log(std::ostream& sink);
138125
void subscribe_events(std::ostream& sink);
126+
void logger(const boost::format& message) const;
127+
void logger(const std::string& message) const;
139128

140129
// Runner.
130+
void stopper(const std::string& message);
141131
void subscribe_connect();
142132
void subscribe_close();
143133
bool do_run();

console/executor_logging.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,21 @@ void executor::subscribe_log(std::ostream& sink)
9999
);
100100
}
101101

102+
void executor::logger(const std::string& message) const
103+
{
104+
if (log_.stopped())
105+
output_ << message << std::endl;
106+
else
107+
log_.write(network::levels::application) << message << std::endl;
108+
}
109+
110+
void executor::logger(const boost::format& message) const
111+
{
112+
if (log_.stopped())
113+
output_ << message << std::endl;
114+
else
115+
log_.write(network::levels::application) << message << std::endl;
116+
}
117+
102118
} // namespace server
103119
} // namespace libbitcoin

console/executor_runner.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ using namespace std::placeholders;
3030
// Runner.
3131
// ----------------------------------------------------------------------------
3232

33+
void executor::stopper(const std::string& message)
34+
{
35+
capture_.stop();
36+
log_.stop(message, network::levels::application);
37+
stopped_.get_future().wait();
38+
}
39+
3340
void executor::subscribe_connect()
3441
{
3542
node_->subscribe_connect

0 commit comments

Comments
 (0)