/usr/include/websocketpp/logger/levels.hpp is in libwebsocketpp-dev 0.7.0-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | /*
* Copyright (c) 2014, Peter Thorson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the WebSocket++ Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef WEBSOCKETPP_LOGGER_LEVELS_HPP
#define WEBSOCKETPP_LOGGER_LEVELS_HPP
#include <websocketpp/common/stdint.hpp>
namespace websocketpp {
namespace log {
/// Type of a channel package
typedef uint32_t level;
/// Package of values for hinting at the nature of a given logger.
/**
* Used by the library to signal to the logging class a hint that it can use to
* set itself up. For example, the `access` hint indicates that it is an access
* log that might be suitable for being printed to an access log file or to cout
* whereas `error` might be suitable for an error log file or cerr.
*/
struct channel_type_hint {
/// Type of a channel type hint value
typedef uint32_t value;
/// No information
static value const none = 0;
/// Access log
static value const access = 1;
/// Error log
static value const error = 2;
};
/// Package of log levels for logging errors
struct elevel {
/// Special aggregate value representing "no levels"
static level const none = 0x0;
/// Low level debugging information (warning: very chatty)
static level const devel = 0x1;
/// Information about unusual system states or other minor internal library
/// problems, less chatty than devel.
static level const library = 0x2;
/// Information about minor configuration problems or additional information
/// about other warnings.
static level const info = 0x4;
/// Information about important problems not severe enough to terminate
/// connections.
static level const warn = 0x8;
/// Recoverable error. Recovery may mean cleanly closing the connection with
/// an appropriate error code to the remote endpoint.
static level const rerror = 0x10;
/// Unrecoverable error. This error will trigger immediate unclean
/// termination of the connection or endpoint.
static level const fatal = 0x20;
/// Special aggregate value representing "all levels"
static level const all = 0xffffffff;
/// Get the textual name of a channel given a channel id
/**
* The id must be that of a single channel. Passing an aggregate channel
* package results in undefined behavior.
*
* @param channel The channel id to look up.
*
* @return The name of the specified channel.
*/
static char const * channel_name(level channel) {
switch(channel) {
case devel:
return "devel";
case library:
return "library";
case info:
return "info";
case warn:
return "warning";
case rerror:
return "error";
case fatal:
return "fatal";
default:
return "unknown";
}
}
};
/// Package of log levels for logging access events
struct alevel {
/// Special aggregate value representing "no levels"
static level const none = 0x0;
/// Information about new connections
/**
* One line for each new connection that includes a host of information
* including: the remote address, websocket version, requested resource,
* http code, remote user agent
*/
static level const connect = 0x1;
/// One line for each closed connection. Includes closing codes and reasons.
static level const disconnect = 0x2;
/// One line per control frame
static level const control = 0x4;
/// One line per frame, includes the full frame header
static level const frame_header = 0x8;
/// One line per frame, includes the full message payload (warning: chatty)
static level const frame_payload = 0x10;
/// Reserved
static level const message_header = 0x20;
/// Reserved
static level const message_payload = 0x40;
/// Reserved
static level const endpoint = 0x80;
/// Extra information about opening handshakes
static level const debug_handshake = 0x100;
/// Extra information about closing handshakes
static level const debug_close = 0x200;
/// Development messages (warning: very chatty)
static level const devel = 0x400;
/// Special channel for application specific logs. Not used by the library.
static level const app = 0x800;
/// Access related to HTTP requests
static level const http = 0x1000;
/// One line for each failed WebSocket connection with details
static level const fail = 0x2000;
/// Aggregate package representing the commonly used core access channels
/// Connect, Disconnect, Fail, and HTTP
static level const access_core = 0x00003003;
/// Special aggregate value representing "all levels"
static level const all = 0xffffffff;
/// Get the textual name of a channel given a channel id
/**
* Get the textual name of a channel given a channel id. The id must be that
* of a single channel. Passing an aggregate channel package results in
* undefined behavior.
*
* @param channel The channelid to look up.
*
* @return The name of the specified channel.
*/
static char const * channel_name(level channel) {
switch(channel) {
case connect:
return "connect";
case disconnect:
return "disconnect";
case control:
return "control";
case frame_header:
return "frame_header";
case frame_payload:
return "frame_payload";
case message_header:
return "message_header";
case message_payload:
return "message_payload";
case endpoint:
return "endpoint";
case debug_handshake:
return "debug_handshake";
case debug_close:
return "debug_close";
case devel:
return "devel";
case app:
return "application";
case http:
return "http";
case fail:
return "fail";
default:
return "unknown";
}
}
};
} // logger
} // websocketpp
#endif //WEBSOCKETPP_LOGGER_LEVELS_HPP
|