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