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
31#ifndef WEBSOCKETPP_LOGGER_SYSLOG_HPP
32#define WEBSOCKETPP_LOGGER_SYSLOG_HPP
36#include <websocketpp/logger/basic.hpp>
38#include <websocketpp/common/cpp11.hpp>
39#include <websocketpp/logger/levels.hpp>
45template <
typename concurrency,
typename names>
48 typedef basic<concurrency, names> base;
52
53
56 :
basic<concurrency,names>(hint), m_channel_type_hint(hint) {}
60
61
62
65 :
basic<concurrency,names>(channels, hint), m_channel_type_hint(hint) {}
69
70
71
72 void write(level channel, std::string
const & msg) {
73 write(channel, msg.c_str());
78
79
80
81 void write(level channel,
char const * msg) {
82 scoped_lock_type lock(base::m_lock);
83 if (!
this->dynamic_test(channel)) {
return; }
84 ::syslog(syslog_priority(channel),
"[%s] %s",
85 names::channel_name(channel), msg);
88 typedef typename base::scoped_lock_type scoped_lock_type;
92 static int const default_level = LOG_INFO;
96
97
98
99 int syslog_priority(level channel)
const {
101 return syslog_priority_access(channel);
103 return syslog_priority_error(channel);
109
110
111
112 int syslog_priority_error(level channel)
const {
127 return default_level;
133
134
135
137 return default_level;
Basic logger that outputs to an ostream.
Basic logger that outputs to syslog.
void write(level channel, char const *msg)
Write a cstring message to the given channel.
void write(level channel, std::string const &msg)
Write a string message to the given channel.
#define _WEBSOCKETPP_CONSTEXPR_TOKEN_
Namespace for the WebSocket++ project.
Package of values for hinting at the nature of a given logger.
static value const access
Access log.
uint32_t value
Type of a channel type hint value.
Package of log levels for logging errors.
static level const devel
Low level debugging information (warning: very chatty)
static level const library
static level const rerror