|
cppthread 1.1.16
C++ Thread Library
|
Declaration of the log class used to send error messages. More...
#include <cstdint>#include <iostream>#include <sstream>

Go to the source code of this file.
Classes | |
| class | cppthread::logger |
| The cppthread logger. More... | |
Typedefs | |
| typedef void(* | cppthread::log_callback) (log_level_t level, std::string const &message) |
| The log callback type definition. | |
Enumerations | |
| enum class | cppthread::log_level_t { debug , info , warning , error , fatal , LOG_LEVEL_SIZE } |
| The log level or severity. More... | |
Functions | |
| logger & | cppthread::end (logger &l) |
| Close a log statement. | |
| void | cppthread::set_log_callback (log_callback callback) |
| Set a callback function. | |
| std::string | cppthread::to_string (log_level_t level) |
| Convert a log level to a string. | |
The library offers a log facility for when messages are generated on errors and various output (i.e. –help).
Definition in file log.h.
| cppthread::log_callback |
|
strong |
|
inline |
This function is used to simplified the end of a log statement:
The result is a call to the logger::end() function which sends the message to the logger current output.
| [in] | l | A reference to the logger. |
Definition at line 90 of file log.h.
References cppthread::logger::end(), and cppthread::end().
Referenced by cppthread::mutex::mutex(), cppthread::guard::~guard(), cppthread::mutex::~mutex(), cppthread::runner::~runner(), cppthread::thread::~thread(), cppthread::mutex::broadcast(), cppthread::mutex::dated_wait(), cppthread::deswappify(), cppthread::end(), cppthread::runner::enter(), cppthread::thread::init(), cppthread::thread::internal_enter(), cppthread::thread::internal_leave(), cppthread::thread::internal_run(), cppthread::thread::internal_thread(), cppthread::runner::leave(), cppthread::mutex::lock(), cppthread::mutex::safe_broadcast(), cppthread::mutex::safe_signal(), cppthread::mutex::signal(), cppthread::thread::start(), cppthread::mutex::timed_wait(), cppthread::mutex::try_lock(), cppthread::mutex::unlock(), and cppthread::mutex::wait().


| void cppthread::set_log_callback | ( | log_callback | callback | ) |
Set a callback function used to redirect the logs generated by the cppthread library and any library that makes use of this log facility (i.e. the advgetopt project does so).
| [in] | callback | The function to call whenever a log is generated. |
Definition at line 170 of file log.cpp.
References cppthread::set_log_callback().
Referenced by cppthread::set_log_callback().


| std::string cppthread::to_string | ( | log_level_t | level | ) |
This function transforms a log_level_t value to a string which can then be used in a log message.
| cppthread_invalid_error | If the log level is not one of the know log levels, then the function raises this exception. |
| [in] | level | The message log level to convert to a string. |
Definition at line 610 of file log.cpp.
References cppthread::to_string().
Referenced by cppthread::pool< W, A >::worker_thread_t::worker_thread_t(), cppthread::logger::end(), and cppthread::to_string().


This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.