plebble
gov.h
Go to the documentation of this file.
1 /*
2 -------------------------------------------------------------------------------
3  PLEBBLE
4 -------------------------------------------------------------------------------
5  Copyright (C) 2019-2020 KATLAS Technology. (http://katlastechnology.com)
6  Copyright (C) 2017-2020 Marcos Mayorga. (mm@mm-studios.com)
7 
8  This file is part of our Plebble(R) Platform.
9 
10  The code below cannot be copied, used for any purpose other than the one
11  agreed and/or distributed without the express permission of
12  KATLAS Technology.
13 -------------------------------------------------------------------------------
14 
15 
16 */
17 #ifndef USGOV_d0f23dafbca742550c16c390d4b32234e2940425bf9c93a4b86c159e8ca6c6d0
18 #define USGOV_d0f23dafbca742550c16c390d4b32234e2940425bf9c93a4b86c159e8ca6c6d0
19 
20 #include "config.h"
21 #include <string>
22 #include <iostream>
23 
24 //--LOGS---------------------------------------------------
25 //write logs to /var/log/us
26 #if CFG_LOGS == 1
27  #define USLOG
28 #endif
29 //---------------------------------------------------------
30 
32 
33 #ifdef USLOG
34  template<typename... F>
35  static void log(const F&... s) {
36  if (us::dbg::thread_logger::instance.disabled) return;
38  }
39 
40  template<typename O>
41  static void logdump(const O& o) {
42  if (us::dbg::thread_logger::instance.disabled) return;
44  }
45 
46  template<typename O>
47  static void logdump(const std::string& prefix, const O& o) {
48  if (us::dbg::thread_logger::instance.disabled) return;
50  }
51 
52  static void log_start(const std::string&dir, const std::string&n) {
53  assert(!n.empty());
54  if (us::dbg::thread_logger::instance.disabled) return;
56  }
57 
58  static void log_pstart(const std::string&n) {
59  assert(!n.empty());
60  if (us::dbg::thread_logger::instance.disabled) return;
61  auto i=n.find_last_of('/');
62  if (i==std::string::npos) {
64  }
65  else {
67  }
68  }
69 
70  static void log_stacktrace(int) {
72  }
73 
74  static void log_info(std::ostream&os) {
76  }
77 
78  static const std::string& log_dir() {
80  }
81 
82 #else
83  #define log (void)sizeof
84  #define logdump (void)sizeof
85  #define log_start (void)sizeof
86  #define log_pstart (void)sizeof
87  #define log_stacktrace (void)sizeof
88  #define log_info (void)sizeof
89  #define log_dir (void)sizeof
90 #endif
91 
92 #ifdef PRIVATE_PERMISSIONED_MESH
93  #define TOPOLOGY "private permissioned mesh"
94 #endif
95 #ifdef PUBLIC_PERMISSIONLESS_MESH
96  #define TOPOLOGY "public permissionless mesh"
97 #endif
98 #ifdef PUBLIC_PERMISSIONED_RING
99  #define TOPOLOGY "public permissionless ring"
100 #endif
101 
102 
103 #endif
104 
105 
106 
us::dbg::thread_logger::pstart
static void pstart(const string &n)
us::dbg::thread_logger::logdump
void logdump(const string &log_level_, const string &log_class_, const O &o)
Definition: thread_logger.h:54
us::dbg::thread_logger::log_info
void log_info(ostream &os) const
log_start
#define log_start
Definition: gov.h:85
thread_logger.h
us::dbg::thread_logger::log_stacktrace
void log_stacktrace() const
Definition: thread_logger.h:63
us::dbg::thread_logger::start
void start(const string &dir, const string &n)
us::dbg::thread_logger::log
void log(const string &log_level_, const string &log_class_, const F &... s)
Definition: thread_logger.h:49
log_stacktrace
#define log_stacktrace
Definition: gov.h:87
us::dbg::thread_logger::get_logdir
const string & get_logdir() const
log_info
#define log_info
Definition: gov.h:88
loglevel
#define loglevel
Definition: peer_t.cpp:18
log_dir
#define log_dir
Definition: gov.h:89
us::dbg::thread_logger::instance
static thread_logger instance
Definition: thread_logger.h:75
logclass
#define logclass
Definition: peer_t.cpp:19
config.h
log_pstart
#define log_pstart
Definition: gov.h:86
log
#define log
Definition: gov.h:83
logdump
#define logdump
Definition: gov.h:84