Goby v2
dccl.cpp
1 // Copyright 2009-2018 Toby Schneider (http://gobysoft.org/index.wt/people/toby)
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 //
6 //
7 // This file is part of the Goby Underwater Autonomy Project Libraries
8 // ("The Goby Libraries").
9 //
10 // The Goby Libraries are free software: you can redistribute them and/or modify
11 // them under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 2.1 of the License, or
13 // (at your option) any later version.
14 //
15 // The Goby Libraries are distributed in the hope that they will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
22 
23 #include "dccl.h"
24 
25 boost::shared_ptr<goby::acomms::DCCLCodec> goby::acomms::DCCLCodec::inst_;
26 
27 std::string goby::acomms::DCCLCodec::glog_encode_group_ = "goby::acomms::dccl::encode";
28 std::string goby::acomms::DCCLCodec::glog_decode_group_ = "goby::acomms::dccl::decode";
29 
30 goby::acomms::DCCLCodec::DCCLCodec() : codec_(new dccl::Codec)
31 {
32  glog.add_group(glog_encode_group_, common::Colors::lt_magenta);
33  glog.add_group(glog_decode_group_, common::Colors::lt_blue);
34 
35  if (!glog.buf().is_quiet())
36  {
37  dccl::logger::Verbosity verbosity = dccl::logger::ALL;
38 
39  switch (glog.buf().highest_verbosity())
40  {
41  default: break;
42  case goby::common::logger::WARN: verbosity = dccl::logger::WARN_PLUS; break;
43  case goby::common::logger::VERBOSE: verbosity = dccl::logger::INFO_PLUS; break;
44  case goby::common::logger::DEBUG1: verbosity = dccl::logger::DEBUG1_PLUS; break;
45  case goby::common::logger::DEBUG2: verbosity = dccl::logger::DEBUG2_PLUS; break;
46  case goby::common::logger::DEBUG3: verbosity = dccl::logger::DEBUG3_PLUS; break;
47  }
48  dccl::dlog.connect(verbosity, this, &DCCLCodec::dlog_message);
49  }
50 }
void add_group(const std::string &name, Colors::Color color=Colors::nocolor, const std::string &description="")
Add another group to the logger. A group provides related manipulator for categorizing log messages...
bool is_quiet() const
do all attached streams have Verbosity == quiet?
common::FlexOstream glog
Access the Goby logger through this object.