|
Gemmi C++ API
|
Passes messages (including warnings/errors) to a callback function. More...
#include <logger.hpp>
Public Member Functions | |
| void | suspend () |
| suspend() and resume() are used internally to avoid duplicate messages when the same function is called (internally) multiple times. | |
| void | resume () |
| template<int N, class... Args> | |
| void | level (Args const &... args) const |
| Send a message without any prefix on with a numeric threshold N. | |
| template<class... Args> | |
| void | debug (Args const &... args) const |
| Send a debug message. | |
| template<class... Args> | |
| void | mesg (Args const &... args) const |
| Send a message without any prefix. | |
| template<class... Args> | |
| void | note (Args const &... args) const |
| Send a note (a notice, a significant message). | |
| template<class... Args> | |
| GEMMI_COLD void | err (Args const &... args) const |
| Send a warning/error (see Quirk above). | |
Static Public Member Functions | |
| static void | to_stderr (const std::string &s) |
| to be used as: logger.callback = Logger::to_stderr; | |
| static void | to_stdout (const std::string &s) |
| to be used as: logger.callback = Logger::to_stdout; | |
Public Attributes | |
| std::function< void(const std::string &)> | callback |
| A function that handles messages. | |
| int | threshold = 6 |
| Pass messages of this level and all lower (more severe) levels: 8=all, 6=all but debug, 5=notes and warnings, 3=warnings, 0=none. | |
Passes messages (including warnings/errors) to a callback function.
Messages are passed as strings without a trailing newline. They have syslog-like severity levels: 8=debug, 6=info, 5=notice, 3=error, allowing the use of a threshold to filter them. Quirk: Errors double as both errors and warnings. Unrecoverable errors don't go through this class; Logger only handles errors that can be downgraded to warnings. If a callback is set, the error is passed as a warning message. Otherwise, it's thrown as std::runtime_error.
Definition at line 23 of file logger.hpp.
|
inline |
suspend() and resume() are used internally to avoid duplicate messages when the same function is called (internally) multiple times.
Definition at line 32 of file logger.hpp.
|
inline |
Definition at line 33 of file logger.hpp.
Send a message without any prefix on with a numeric threshold N.
Definition at line 36 of file logger.hpp.
Send a debug message.
Definition at line 42 of file logger.hpp.
Send a message without any prefix.
Definition at line 44 of file logger.hpp.
Send a note (a notice, a significant message).
Definition at line 46 of file logger.hpp.
|
inline |
Send a warning/error (see Quirk above).
Definition at line 49 of file logger.hpp.
to be used as: logger.callback = Logger::to_stderr;
Definition at line 61 of file logger.hpp.
to be used as: logger.callback = Logger::to_stdout;
Definition at line 65 of file logger.hpp.
A function that handles messages.
Definition at line 25 of file logger.hpp.
| int gemmi::Logger::threshold = 6 |
Pass messages of this level and all lower (more severe) levels: 8=all, 6=all but debug, 5=notes and warnings, 3=warnings, 0=none.
Definition at line 28 of file logger.hpp.