forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging_utils.h
47 lines (42 loc) · 1.92 KB
/
logging_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef CPPREST_LOGGING_UTILS_H
#define CPPREST_LOGGING_UTILS_H
#include <functional>
#include "cpprest/details/basic_types.h"
// Experimental extension to cpprestsdk framework to be able to add logging callbacks
// to e.g. http_listener, websocket_listener
namespace web
{
namespace logging
{
namespace experimental
{
typedef uint32_t level;
namespace levels
{
// Low level debugging information (warning: very chatty)
const level devel = 0x1;
// Information about unusual system states or other minor internal library
// problems, less chatty than devel.
const level verbose = 0x2;
// Information about minor configuration problems or additional information
// about other warnings.
const level info = 0x4;
// Information about important problems not severe enough to terminate
// connections.
const level warning = 0x8;
// Recoverable error. Recovery may mean cleanly closing the connection with
// an appropriate error code to the remote endpoint.
const level error = 0x10;
// Unrecoverable error. This error will trigger immediate unclean
// termination of the connection or endpoint.
const level severe = 0x20;
}
// A logging callback includes the level, a message and optionally (i.e. maybe empty) category identifier
// (similar to http_exception, use std::string rather than utility::string_t to simplify integration with <system_error>, etc.)
typedef void (log_signature)(level level, const std::string& message, const std::string& category);
typedef log_signature* log_ptr;
typedef std::function<log_signature> log_handler;
}
}
}
#endif