The main Logging class for cuML library. More...
#include <logger.hpp>
Public Member Functions | |
void | setLevel (int level) |
Set the logging level. More... | |
void | setPattern (const std::string &pattern) |
Set the logging pattern. More... | |
void | setCallback (void(*callback)(int lvl, const char *msg)) |
Register a callback function to be run in place of usual log call. More... | |
void | setFlush (void(*flush)()) |
Register a flush function compatible with the registered callback. More... | |
bool | shouldLogFor (int level) const |
Tells whether messages will be logged for the given log level. More... | |
int | getLevel () const |
Query for the current log level. More... | |
std::string | getPattern () const |
Get the current logging pattern. More... | |
void | log (int level, const char *fmt,...) |
Main logging method. More... | |
void | flush () |
Flush logs by calling flush on underlying logger. More... | |
Static Public Member Functions | |
static Logger & | get () |
Singleton method to get the underlying logger object. More... | |
The main Logging class for cuML library.
This class acts as a thin wrapper over the underlying spdlog
interface. The design is done in this way in order to avoid us having to also ship spdlog
header files in our installation.
void ML::Logger::flush | ( | ) |
Flush logs by calling flush on underlying logger.
|
static |
Singleton method to get the underlying logger object.
int ML::Logger::getLevel | ( | ) | const |
Query for the current log level.
|
inline |
Get the current logging pattern.
void ML::Logger::log | ( | int | level, |
const char * | fmt, | ||
... | |||
) |
Main logging method.
[in] | level | logging level of this message |
[in] | fmt | C-like format string, followed by respective params |
void ML::Logger::setCallback | ( | void(*)(int lvl, const char *msg) | callback | ) |
Register a callback function to be run in place of usual log call.
[in] | callback | the function to be run on all logged messages |
void ML::Logger::setFlush | ( | void(*)() | flush | ) |
Register a flush function compatible with the registered callback.
[in] | flush | the function to use when flushing logs |
void ML::Logger::setLevel | ( | int | level | ) |
Set the logging level.
Only messages with level equal or above this will be printed
[in] | level | logging level |
void ML::Logger::setPattern | ( | const std::string & | pattern | ) |
Set the logging pattern.
[in] | pattern | the pattern to be set. Refer this link https://github.com/gabime/spdlog/wiki/3.-Custom-formatting to know the right syntax of this pattern |
bool ML::Logger::shouldLogFor | ( | int | level | ) | const |
Tells whether messages will be logged for the given log level.
[in] | level | log level to be checked for |