25#ifndef GOBY_UTIL_DEBUG_LOGGER_FLEX_OSTREAMBUF_H
26#define GOBY_UTIL_DEBUG_LOGGER_FLEX_OSTREAMBUF_H
38#include <boost/date_time.hpp>
68extern std::recursive_mutex
mutex;
100 void name(
const std::string& s) { name_ = s; }
139 void display(std::string& s);
140 void strip_escapes(std::string& s);
143 std::deque<std::string> buffer_;
148 StreamConfig(std::ostream* os,
logger::Verbosity verbosity) : os_(os), verbosity_(verbosity)
154 std::ostream* os()
const {
return os_; }
163 std::string group_name_;
165 std::map<std::string, logger::Group> groups_;
167 std::atomic<bool> die_flag_;
168 std::atomic<logger::Verbosity> current_verbosity_;
170 FlexNCurses* curses_;
171 std::shared_ptr<std::thread> input_thread_;
173 boost::posix_time::ptime start_time_;
175 std::vector<StreamConfig> streams_;
179 std::atomic<logger::Verbosity> highest_verbosity_;
181 std::atomic<logger_lock::LockAction> lock_action_;
void set_lock_action(logger_lock::LockAction lock_action)
void set_die_flag(bool b)
exit on error at the next call to sync()
void set_verbosity_depth(logger::Verbosity depth)
int overflow(int c=EOF)
virtual inherited from std::streambuf. Called when something is inserted into the stream
void group_name(const std::string &s)
current group name (last insertion of group("") into the stream)
bool is_quiet() const
do all attached streams have Verbosity == quiet?
void name(const std::string &s)
name of the application being served
bool is_gui() const
is there an attached stream with Verbosity == gui (ncurses GUI)
FlexOStreamBuf(FlexOstream *parent)
logger_lock::LockAction lock_action()
void refresh()
refresh the display (does nothing if !is_gui())
logger::Verbosity verbosity_depth()
void add_group(const std::string &name, logger::Group g)
add a new group
void remove_stream(std::ostream *os)
remove a stream from the logger
logger::Verbosity highest_verbosity() const
void add_stream(logger::Verbosity verbosity, std::ostream *os)
add a stream to the logger
int sync()
virtual inherited from std::streambuf. Called when std::endl or std::flush is inserted into the strea...
Forms the basis of the Goby logger: std::ostream derived class for holding the FlexOStreamBuf.
Defines a group of messages to be sent to the Goby logger. For Verbosity == verbose streams,...
static constexpr Verbosity DEBUG1
static constexpr Verbosity VERBOSE
static constexpr Verbosity DEBUG2
static constexpr Verbosity WARN
static constexpr Verbosity QUIET
static constexpr Verbosity DEBUG3
LockAction
Mutex actions available to the Goby logger (glogger)
std::recursive_mutex mutex
The global namespace for the Goby project.