icedb
version 0.5.1
Snow particle scattering database API
lib
icedb
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
{
11
ICEDB_LOG_DEBUG_2
,
12
ICEDB_LOG_DEBUG_1
,
13
ICEDB_LOG_INFO
,
14
ICEDB_LOG_NORMAL
,
15
ICEDB_LOG_NOTIFICATION
,
16
ICEDB_LOG_DEBUG_WARNING
,
17
ICEDB_LOG_ERROR
,
18
ICEDB_LOG_CRITICAL
19
};
20
struct
log_properties
{
21
//log_properties();
22
bool
debugChannel
;
23
::std::string
logFile
;
24
int
consoleLogThreshold
;
25
int
debuggerLogThreshold
;
26
};
27
typedef
void(*
log_handler_ft
)(
const
char
*,
const
char
*,
PRIORITIES
);
28
void
register_log_handler
(
log_handler_ft
);
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,
37
PRIORITIES
p =
ICEDB_LOG_NORMAL
);
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); }
icedb::logging::ICEDB_LOG_INFO
Definition:
logging.hpp:13
icedb::logging::log_properties
Definition:
logging.hpp:20
icedb::logging::ICEDB_LOG_ERROR
Definition:
logging.hpp:17
icedb::logging::ICEDB_LOG_CRITICAL
Definition:
logging.hpp:18
icedb::logging::ICEDB_LOG_DEBUG_1
Definition:
logging.hpp:12
defs.h
icedb::logging::log_properties::logFile
::std::string logFile
Definition:
logging.hpp:23
icedb::logging::register_log_handler
void register_log_handler(log_handler_ft p)
Definition:
logging.cpp:23
icedb::logging::log_properties::debugChannel
bool debugChannel
Definition:
logging.hpp:22
icedb::logging::log_properties::debuggerLogThreshold
int debuggerLogThreshold
Definition:
logging.hpp:25
icedb::logging::emit_log
void emit_log(const std::string &channel, const std::string &message, PRIORITIES p)
Definition:
logging.cpp:16
icedb::logging::log_properties::consoleLogThreshold
int consoleLogThreshold
Definition:
logging.hpp:24
icedb::logging::ICEDB_LOG_NOTIFICATION
Definition:
logging.hpp:15
icedb
Definition:
Attributes.cpp:8
icedb::logging::log_handler_ft
void(* log_handler_ft)(const char *, const char *, PRIORITIES)
Definition:
logging.hpp:27
icedb::logging::ICEDB_LOG_DEBUG_2
Definition:
logging.hpp:11
icedb::logging::ICEDB_LOG_NORMAL
Definition:
logging.hpp:14
icedb::logging::ICEDB_LOG_DEBUG_WARNING
Definition:
logging.hpp:16
icedb::logging::PRIORITIES
PRIORITIES
Definition:
logging.hpp:10
icedb::logging::setupLogging
void setupLogging(int argc, char **argv, const log_properties *lps)
Definition:
logging.cpp:47
Generated by
1.8.13