Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
websocketpp::log::basic< concurrency, names > Class Template Reference

Basic logger that outputs to an ostream. More...

#include <basic.hpp>

Inheritance diagram for websocketpp::log::basic< concurrency, names >:

Public Member Functions

 basic (channel_type_hint::value h=channel_type_hint::access)
 
 basic (std::ostream *out)
 
 basic (level c, channel_type_hint::value h=channel_type_hint::access)
 
 basic (level c, std::ostream *out)
 
 ~basic ()
 Destructor.
 
 basic (basic< concurrency, names > const &other)
 Copy constructor.
 
void set_ostream (std::ostream *out=&std::cout)
 
void set_channels (level channels)
 
void clear_channels (level channels)
 
void write (level channel, std::string const &msg)
 Write a string message to the given channel.
 
void write (level channel, char const *msg)
 Write a cstring message to the given channel.
 
_WEBSOCKETPP_CONSTEXPR_TOKEN_ bool static_test (level channel) const
 
bool dynamic_test (level channel)
 

Protected Types

typedef concurrency::scoped_lock_type scoped_lock_type
 
typedef concurrency::mutex_type mutex_type
 

Protected Attributes

mutex_type m_lock
 

Detailed Description

template<typename concurrency, typename names>
class websocketpp::log::basic< concurrency, names >

Definition at line 59 of file basic.hpp.

Member Typedef Documentation

◆ mutex_type

template<typename concurrency , typename names >
concurrency::mutex_type websocketpp::log::basic< concurrency, names >::mutex_type
protected

Definition at line 170 of file basic.hpp.

◆ scoped_lock_type

template<typename concurrency , typename names >
concurrency::scoped_lock_type websocketpp::log::basic< concurrency, names >::scoped_lock_type
protected

Definition at line 169 of file basic.hpp.

Constructor & Destructor Documentation

◆ basic() [1/5]

template<typename concurrency , typename names >
websocketpp::log::basic< concurrency, names >::basic ( channel_type_hint::value h = channel_type_hint::access)
inline

Definition at line 1 of file basic.hpp.

63 : m_static_channels(0xffffffff)
64 , m_dynamic_channels(0)
65 , m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {}
static value const error
Error log.
Definition levels.hpp:55

◆ basic() [2/5]

template<typename concurrency , typename names >
websocketpp::log::basic< concurrency, names >::basic ( std::ostream * out)
inline

Definition at line 1 of file basic.hpp.

68 : m_static_channels(0xffffffff)
69 , m_dynamic_channels(0)
70 , m_out(out) {}

◆ basic() [3/5]

template<typename concurrency , typename names >
websocketpp::log::basic< concurrency, names >::basic ( level c,
channel_type_hint::value h = channel_type_hint::access )
inline

Definition at line 1 of file basic.hpp.

74 : m_static_channels(c)
75 , m_dynamic_channels(0)
76 , m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {}

◆ basic() [4/5]

template<typename concurrency , typename names >
websocketpp::log::basic< concurrency, names >::basic ( level c,
std::ostream * out )
inline

Definition at line 1 of file basic.hpp.

79 : m_static_channels(c)
80 , m_dynamic_channels(0)
81 , m_out(out) {}

◆ ~basic()

template<typename concurrency , typename names >
websocketpp::log::basic< concurrency, names >::~basic ( )
inline

Definition at line 1 of file basic.hpp.

84{}

◆ basic() [5/5]

template<typename concurrency , typename names >
websocketpp::log::basic< concurrency, names >::basic ( basic< concurrency, names > const & other)
inline

Definition at line 1 of file basic.hpp.

88 : m_static_channels(other.m_static_channels)
89 , m_dynamic_channels(other.m_dynamic_channels)
90 , m_out(other.m_out)
91 {}

Member Function Documentation

◆ clear_channels()

template<typename concurrency , typename names >
void websocketpp::log::basic< concurrency, names >::clear_channels ( level channels)
inline

Definition at line 127 of file basic.hpp.

127 {
129 m_dynamic_channels &= ~channels;
130 }
concurrency::scoped_lock_type scoped_lock_type
Definition basic.hpp:169
void lock()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dynamic_test()

template<typename concurrency , typename names >
bool websocketpp::log::basic< concurrency, names >::dynamic_test ( level channel)
inline

Definition at line 164 of file basic.hpp.

164 {
165 return ((channel & m_dynamic_channels) != 0);
166 }
Here is the caller graph for this function:

◆ set_channels()

template<typename concurrency , typename names >
void websocketpp::log::basic< concurrency, names >::set_channels ( level channels)
inline

Definition at line 117 of file basic.hpp.

117 {
118 if (channels == names::none) {
119 clear_channels(names::all);
120 return;
121 }
122
124 m_dynamic_channels |= (channels & m_static_channels);
125 }
void clear_channels(level channels)
Definition basic.hpp:127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_ostream()

template<typename concurrency , typename names >
void websocketpp::log::basic< concurrency, names >::set_ostream ( std::ostream * out = &std::cout)
inline

Definition at line 113 of file basic.hpp.

113 {
114 m_out = out;
115 }

◆ static_test()

template<typename concurrency , typename names >
_WEBSOCKETPP_CONSTEXPR_TOKEN_ bool websocketpp::log::basic< concurrency, names >::static_test ( level channel) const
inline

Definition at line 160 of file basic.hpp.

160 {
161 return ((channel & m_static_channels) != 0);
162 }

◆ write() [1/2]

template<typename concurrency , typename names >
void websocketpp::log::basic< concurrency, names >::write ( level channel,
char const * msg )
inline
Parameters
channelThe channel to write to
msgThe message to write

Definition at line 151 of file basic.hpp.

151 {
153 if (!this->dynamic_test(channel)) { return; }
154 *m_out << "[" << timestamp << "] "
155 << "[" << names::channel_name(channel) << "] "
156 << msg << "\n";
157 m_out->flush();
158 }
bool dynamic_test(level channel)
Definition basic.hpp:164
Here is the call graph for this function:

◆ write() [2/2]

template<typename concurrency , typename names >
void websocketpp::log::basic< concurrency, names >::write ( level channel,
std::string const & msg )
inline
Parameters
channelThe channel to write to
msgThe message to write

Definition at line 137 of file basic.hpp.

137 {
139 if (!this->dynamic_test(channel)) { return; }
140 *m_out << "[" << timestamp << "] "
141 << "[" << names::channel_name(channel) << "] "
142 << msg << "\n";
143 m_out->flush();
144 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_lock

template<typename concurrency , typename names >
mutex_type websocketpp::log::basic< concurrency, names >::m_lock
protected

Definition at line 171 of file basic.hpp.


The documentation for this class was generated from the following file: