adds configurable static logging channels

This commit is contained in:
Peter Thorson
2013-04-08 09:44:32 -05:00
parent 1e97e3dcf5
commit c8fada14f7
2 changed files with 30 additions and 3 deletions

View File

@@ -111,7 +111,33 @@ struct core {
* recommended.
*/
static const int client_version = 13; // RFC6455
/// Default static error logging channels
/**
* Which error logging channels to enable at compile time. Channels not
* enabled here will be unable to be selected by programs using the library.
* This option gives an optimizing compiler the ability to remove entirely
* code to test whether or not to print out log messages on a certain
* channel
*
* Default is all except for development/debug level errors
*/
static const websocketpp::log::level elog_level =
websocketpp::log::elevel::all ^ websocketpp::log::elevel::devel;
/// Default static access logging channels
/**
* Which access logging channels to enable at compile time. Channels not
* enabled here will be unable to be selected by programs using the library.
* This option gives an optimizing compiler the ability to remove entirely
* code to test whether or not to print out log messages on a certain
* channel
*
* Default is all except for development/debug level access messages
*/
static const websocketpp::log::level alog_level =
websocketpp::log::alevel::all ^ websocketpp::log::alevel::devel;
///
static const size_t connection_read_buffer_size = 512;

View File

@@ -89,12 +89,13 @@ public:
typedef lib::shared_ptr<connection_weak_ptr> hdl_type;
explicit endpoint(bool is_server)
: m_elog(&std::cerr)
: m_alog(config::alog_level,&std::cout)
, m_elog(config::elog_level,&std::cerr)
, m_user_agent(::websocketpp::user_agent)
, m_is_server(is_server)
{
m_alog.set_channels(0xffffffff);
m_elog.set_channels(0xffffffff);
m_alog.set_channels(config::alog_level);
m_elog.set_channels(config::elog_level);
m_alog.write(log::alevel::devel,"endpoint constructor");