aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-11-18 21:52:35 -0500
committerDeterminant <[email protected]>2018-11-18 21:52:35 -0500
commit35ffa2c1e5c7fba06c52e2c20aff2aac910921d5 (patch)
tree7adcea80aac36059811df618901ca38e656e282c /include
parentcff8386147356176228b8c56573005bca2b65d0a (diff)
...
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/network.h15
-rw-r--r--include/salticidae/util.h1
2 files changed, 14 insertions, 2 deletions
diff --git a/include/salticidae/network.h b/include/salticidae/network.h
index a71c5dd..1e63efa 100644
--- a/include/salticidae/network.h
+++ b/include/salticidae/network.h
@@ -601,8 +601,19 @@ bool PeerNetwork<O, _, __>::check_new_conn(const conn_t &conn, uint16_t port) {
p->reset_ping_timer();
p->send_ping();
if (p->connected)
- SALTICIDAE_LOG_INFO("PeerNetwork: established connection with %s via %s",
- std::string(conn->peer_id).c_str(), std::string(*conn).c_str());
+ {
+ auto color_begin = "";
+ auto color_end = "";
+ if (logger.is_tty())
+ {
+ color_begin = TTY_COLOR_BLUE;
+ color_end = TTY_COLOR_RESET;
+ }
+ SALTICIDAE_LOG_INFO("%sPeerNetwork: established connection with %s via %s%s",
+ color_begin,
+ std::string(conn->peer_id).c_str(), std::string(*conn).c_str(),
+ color_end);
+ }
return false;
}
diff --git a/include/salticidae/util.h b/include/salticidae/util.h
index ed7d980..c640de7 100644
--- a/include/salticidae/util.h
+++ b/include/salticidae/util.h
@@ -101,6 +101,7 @@ class Logger {
void debug(const char *fmt, ...);
void warning(const char *fmt, ...);
void error(const char *fmt, ...);
+ bool is_tty() { return isatty(output); }
};
extern Logger logger;