23 #ifndef FlexOStreamBuf20091110H 24 #define FlexOStreamBuf20091110H 32 #include <boost/thread.hpp> 34 #include <boost/date_time.hpp> 35 #include <boost/shared_ptr.hpp> 37 #include "goby/common/protobuf/logger.pb.h" 39 #include "term_color.h" 61 extern boost::recursive_mutex mutex;
66 QUIET = protobuf::GLogConfig::QUIET,
67 WARN = protobuf::GLogConfig::WARN,
68 VERBOSE = protobuf::GLogConfig::VERBOSE,
70 DEBUG1 = protobuf::GLogConfig::DEBUG1,
71 DEBUG2 = protobuf::GLogConfig::DEBUG2,
72 DEBUG3 = protobuf::GLogConfig::DEBUG3,
90 int overflow(
int c = EOF);
93 void name(
const std::string& s) { name_ = s; }
96 void add_stream(logger::Verbosity verbosity, std::ostream* os);
99 bool is_quiet()
const {
return highest_verbosity_ == logger::QUIET; }
106 logger::Verbosity highest_verbosity()
const {
return highest_verbosity_; }
114 void set_verbosity_depth(logger::Verbosity depth) { current_verbosity_ = depth; }
116 logger::Verbosity verbosity_depth() {
return current_verbosity_; }
119 void add_group(
const std::string& name,
Group g);
124 void set_lock_action(logger_lock::LockAction lock_action) { lock_action_ = lock_action; }
126 logger_lock::LockAction lock_action() {
return lock_action_; }
129 void display(std::string& s);
130 void strip_escapes(std::string& s);
133 std::deque<std::string> buffer_;
138 StreamConfig(std::ostream* os, logger::Verbosity verbosity) : os_(os), verbosity_(verbosity)
142 void set_verbosity(logger::Verbosity verbosity) { verbosity_ = verbosity; }
144 std::ostream* os()
const {
return os_; }
145 logger::Verbosity verbosity()
const {
return verbosity_; }
149 logger::Verbosity verbosity_;
153 std::string group_name_;
155 std::map<std::string, Group> groups_;
158 logger::Verbosity current_verbosity_;
161 boost::shared_ptr<boost::thread> input_thread_;
163 boost::posix_time::ptime start_time_;
165 std::vector<StreamConfig> streams_;
169 logger::Verbosity highest_verbosity_;
171 logger_lock::LockAction lock_action_;
bool is_gui() const
is there an attached stream with Verbosity == gui (ncurses GUI)
void name(const std::string &s)
name of the application being served
void set_die_flag(bool b)
exit on error at the next call to sync()
Forms the basis of the Goby logger: std::ostream derived class for holding the FlexOStreamBuf.
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?
The global namespace for the Goby project.
Enables the Verbosity == gui mode of the Goby logger and displays an NCurses gui for the logger conte...
Defines a group of messages to be sent to the Goby logger. For Verbosity == verbose streams...