icedb  version 0.5.1
Snow particle scattering database API
logging.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "defs.h"
3 #include <iostream>
4 #include <sstream>
5 #include <string>
6 
7 
8 namespace icedb {
9  namespace logging {
10  enum PRIORITIES {
19  };
20  struct log_properties {
21  //log_properties();
23  ::std::string logFile;
26  };
27  typedef void(*log_handler_ft)(const char*, const char*, PRIORITIES);
29  void emit_log(
30  const char* channel,
31  const char* message,
32  PRIORITIES p
33  );
34  void emit_log(
35  const std::string &channel,
36  const std::string &message,
38  void setupLogging(
39  int argc = 0,
40  char** argv = nullptr,
41  const log_properties* lps = nullptr);
42  }
43 }
44 
45 #define ICEDB_log(c,p,x) { ::std::ostringstream l; l << x; \
46  ::std::string s = l.str(); \
47  ::icedb::logging::emit_log(c, s, p); }
void register_log_handler(log_handler_ft p)
Definition: logging.cpp:23
void emit_log(const std::string &channel, const std::string &message, PRIORITIES p)
Definition: logging.cpp:16
void(* log_handler_ft)(const char *, const char *, PRIORITIES)
Definition: logging.hpp:27
void setupLogging(int argc, char **argv, const log_properties *lps)
Definition: logging.cpp:47