17 #ifndef USGOV_cc4a6c5e5e2c6e084fa5b97911783920c4c9c1fc5b484939dbc7448e7ebcb559 
   18 #define USGOV_cc4a6c5e5e2c6e084fa5b97911783920c4c9c1fc5b484939dbc7448e7ebcb559 
   20 #include <unordered_map> 
   29 #include <sys/types.h> 
   34 namespace us { 
namespace dbg {
 
   36     using namespace chrono;
 
   44         void start(
const string&dir, 
const string&name);
 
   45         static bool start(ostream*&, 
const thread_logger&, 
const string& dir, 
const string&name, 
short g);
 
   47         template<
typename type1>
 
   49             *logfile << arg1 << 
' ';
 
   50             if (teecout) std::cout << arg1 << 
' ';
 
   53         template<
typename type1, 
typename... types>
 
   54         void dolog(
const type1& arg1, 
const types& ... args) {
 
   59         static void prefix(ostream&, 
const thread_logger&, 
const string&log_level_, 
const string& log_class_);
 
   61         template<
typename... Args>
 
   62         void log(
const string&log_level, 
const string& log_class, 
const Args&... args) {
 
   64             if (logfile==0) start(
"",
"unknown");
 
   66             prefix(*logfile,logger,log_level,log_class);
 
   67             if (teecout) prefix(std::cout,logger,log_level,log_class);
 
   71             if (teecout) std::cout << endl;
 
   75         void logdump(
const string&log_level, 
const string&log_class, 
const O& o) {
 
   78             prefix(pfx,logger,log_level,log_class);
 
   79             o.dump(pfx.str(),*logfile);
 
   81                 o.dump(pfx.str(),std::cout);
 
   86         void logdump(
const string&log_level, 
const string&log_class, 
const string&logpfx, 
const O& o) {
 
   89             prefix(pfx,logger,log_level,log_class);
 
   90             string spfx=pfx.str()+logpfx;
 
   91             o.dump(spfx,*logfile);
 
   93                 o.dump(spfx,std::cout);
 
  101         bool ownlogfile{
true};