mod_servlet
C++Servlets
 All Classes Files Functions Variables Typedefs Macros Pages
servlet::logging::level_logger Class Reference

Logger with specific logging LEVEL to use. More...

#include <logger.h>

Public Member Functions

template<typename T >
level_loggeroperator<< (const T &value)
 Generic streaming output operator. More...
 
level_loggeroperator<< (std::ostream &(*manip)(std::ostream &))
 Streaming output operator for manipulators (e.g. More...
 
level_loggeroperator<< (char ch)
 Streaming output operator for char. More...
 
level_loggeroperator<< (char16_t ch)
 Streaming output operator for char16_t. More...
 
level_loggeroperator<< (const char16_t *str)
 Writes C-style array of character of type char16_t to the output. More...
 
level_loggeroperator<< (const std::u16string &str)
 Writes string of character of type char16_t to the output. More...
 
level_loggeroperator<< (char32_t ch)
 Streaming output operator for char32_t. More...
 
level_loggeroperator<< (const char32_t *str)
 Writes C-style array of character of type char32_t to the output. More...
 
level_loggeroperator<< (const std::u32string &str)
 Writes string of character of type char32_t to the output. More...
 
level_loggeroperator<< (wchar_t ch)
 Streaming output operator for wchar_t. More...
 
level_loggeroperator<< (const wchar_t *str)
 Writes C-style array of character of type wchar_t to the output. More...
 
level_loggeroperator<< (const std::wstring &str)
 Writes string of wide characters to the output. More...
 
level_loggerflush ()
 Flushes underlying stream. More...
 
level_loggerput (char ch)
 Puts a character of type wchar to output if the logging level is sufficient. More...
 
level_loggerput (char16_t ch)
 Puts a character of type char16_t to output if the logging level is sufficient. More...
 
level_loggerput (char32_t ch)
 Puts a character of type char32_t to output if the logging level is sufficient. More...
 
level_loggerput (wchar_t ch)
 Puts a character of type wchar_t to output if the logging level is sufficient. More...
 
level_loggerwrite (const char *s, std::streamsize n)
 Writes first n characters of array s to the output stream if the logging level is sufficient. More...
 

Friends

class logger
 

Detailed Description

Logger with specific logging LEVEL to use.

This logger has overloaded streaming output operators which will output the object into the underlying stream. It also has the special treatment for international characters and UTF strings. It convers UTF-16 and UTF-32 strings into UTF_8 and prints them.

For example the following output will be hadled correctly:

auto lg = servlet::get_logger();
std::u16string u16str{u"\u4f60\u597d"};
std::u32string u32str{U"の場合"};
lg->warning() << str << std::endl;
lg->warning() << "utf-16 string: " << u16str << std::endl;
lg->warning() << "utf-16 array: " << u"鵝滿是快烙滴好耳痛" << std::endl;
lg->warning() << "utf-32 string: " << u32str << std::endl;
lg->warning() << "utf-32 array: " << U"野家のコピペ" << std::endl;
See Also
logger.log
logger.critical
logger.error
logger.warning
logger.info
logger.config
logger.debug
logger.trace

Member Function Documentation

level_logger& servlet::logging::level_logger::flush ( )
inline

Flushes underlying stream.

Returns
reference to self
template<typename T >
level_logger & servlet::logging::level_logger::operator<< ( const T &  value)
inline

Generic streaming output operator.

The value will be passed to actual output stream if the logging level is sufficient for the object to be printed.

Template Parameters
Ttype of the value to send to a stream.
Parameters
valueobject to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::operator<< ( std::ostream &(*)(std::ostream &)  manip)

Streaming output operator for manipulators (e.g.

std::endl).

Parameters
manipmainpulator to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::operator<< ( char  ch)

Streaming output operator for char.

This method does nothing if the logging level is not sufficient.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::operator<< ( char16_t  ch)

Streaming output operator for char16_t.

This method does nothing if the logging level is not sufficient.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::operator<< ( const char16_t *  str)

Writes C-style array of character of type char16_t to the output.

This method does nothing if the logging level is not sufficient.

This string is handled as string of UTF-16 characters. They are converted to UTF-8 before being passed to the output stream.

Parameters
strC-array of characters to write to the output stream
Returns
reference to self.
level_logger& servlet::logging::level_logger::operator<< ( const std::u16string &  str)

Writes string of character of type char16_t to the output.

This method does nothing if the logging level is not sufficient.

This string is handled as string of UTF-16 characters. They are converted to UTF-8 before being passed to the output stream.

Parameters
strUTF-16 string to write to the output stream
Returns
reference to self.
level_logger& servlet::logging::level_logger::operator<< ( char32_t  ch)

Streaming output operator for char32_t.

This method does nothing if the logging level is not sufficient.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::operator<< ( const char32_t *  str)

Writes C-style array of character of type char32_t to the output.

This method does nothing if the logging level is not sufficient.

This string is handled as string of UTF-32 characters. They are converted to UTF-8 before being passed to the output stream.

Parameters
strC-array of characters to write to the output stream
Returns
reference to self.
level_logger& servlet::logging::level_logger::operator<< ( const std::u32string &  str)

Writes string of character of type char32_t to the output.

This method does nothing if the logging level is not sufficient.

This string is handled as string of UTF-32 characters. They are converted to UTF-8 before being passed to the output stream.

Parameters
strUTF-32 string to write to the output stream
Returns
reference to self.
level_logger& servlet::logging::level_logger::operator<< ( wchar_t  ch)

Streaming output operator for wchar_t.

This method does nothing if the logging level is not sufficient.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::operator<< ( const wchar_t *  str)

Writes C-style array of character of type wchar_t to the output.

This method does nothing if the logging level is not sufficient.

This string is handled as string of wide characters. They are converted to UTF-8 before being passed to the output stream.

Parameters
strC-array of characters to write to the output stream
Returns
reference to self.
level_logger& servlet::logging::level_logger::operator<< ( const std::wstring &  str)

Writes string of wide characters to the output.

This method does nothing if the logging level is not sufficient.

This string is handled as string of wide characters. They are converted to UTF-8 before being passed to the output stream.

Parameters
strwchar_t string to write to the output stream
Returns
reference to self.
level_logger& servlet::logging::level_logger::put ( char  ch)
inline

Puts a character of type wchar to output if the logging level is sufficient.

Otherwise does nothing.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::put ( char16_t  ch)
inline

Puts a character of type char16_t to output if the logging level is sufficient.

Otherwise does nothing.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::put ( char32_t  ch)
inline

Puts a character of type char32_t to output if the logging level is sufficient.

Otherwise does nothing.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::put ( wchar_t  ch)
inline

Puts a character of type wchar_t to output if the logging level is sufficient.

Otherwise does nothing.

Parameters
chcharacter to print.
Returns
reference to self
level_logger& servlet::logging::level_logger::write ( const char *  s,
std::streamsize  n 
)

Writes first n characters of array s to the output stream if the logging level is sufficient.

Parameters
sArray of at least n characters.
nNumber of characters to write.
Returns
reference to self.

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