|
Protocol++® (Protocolpp®)
v5.7.0
|
#include "include/jlogger.h"
Public Types | |
| enum | asciicolor { BLACK =30 , RED =31 , GREEN =32 , YELLOW =33 , BLUE =34 , MAGENTA =35 , CYAN =36 , WHITE =37 , BRIGHTBLACK =90 , BRIGHTRED =91 , BRIGHTGREEN =92 , BRIGHTYELLOW =93 , BRIGHTBLUE =94 , BRIGHTMAGENTA =95 , BRIGHTCYAN =96 , BRIGHTWHITE =97 } |
| enum | severity_t { debug =1 , info , warning , error , fatal , pass } |
Public Member Functions | |
| jlogger (const std::string &name, bool logstdout=false, severity_t loglvl=severity_t::info, jlogger::asciicolor debugclr=jlogger::asciicolor::MAGENTA, jlogger::asciicolor infoclr=jlogger::asciicolor::CYAN, jlogger::asciicolor warningclr=jlogger::asciicolor::BRIGHTYELLOW, jlogger::asciicolor errorclr=jlogger::asciicolor::RED, jlogger::asciicolor fatalclr=jlogger::asciicolor::RED, jlogger::asciicolor passclr=jlogger::asciicolor::GREEN) | |
| template<typename jlogger::severity_t , typename... Args> | |
| void | print (Args...args) |
| ~jlogger () | |
| standard deconstructor | |
| void | set_loglvl (severity_t newlvl) |
| void | set_color (std::string color, jlogger::asciicolor jcolor) |
| severity_t | get_loglvl () |
| jlogger::asciicolor | get_color (std::string color) |
Static Public Member Functions | |
| static std::string | toStr (jlogger::asciicolor jcolor) |
| static std::string | toCode (jlogger::asciicolor jcolor) |
| static jlogger::asciicolor | toEnum (std::string color) |
#ifdef DARK_THEME line.insert(0, "\033[1;34m "); #else line.insert(0, "\033[1;30m "); #endif } else if (line.find("<DEBUG>") != std::string::npos) { #ifdef DARK_THEME line.insert(0, "\033[1;35m "); #else line.insert(0, "\033[1;34m "); #endif } else if (line.find("<WARN>") != std::string::npos) { #ifdef LIGHT_THEME line.insert(0, "\033[0;34m "); #else line.insert(0, "\033[1;33m "); #endif } else if (line.find("<ERROR>") != std::string::npos) { #ifdef LIGHT_THEME line.insert(0, "\033[1;31m "); #else line.insert(0, "\033[1;31m "); #endif } else if (line.find("<FATAL>") != std::string::npos) { #ifdef DARK_THEME line.insert(0, "\033[1;35m "); #else line.insert(0, "\033[1;35m "); #endif } else if (line.find("<PASS>") != std::string::npos) { #ifdef DARK_THEME line.insert(0, "\033[1;32m "); #else line.insert(0, "\033[1;32m "); #endif } else { #ifdef DARK_THEME line.insert(0, "\033[1;34m "); #else line.insert(0, "\033[1;34m "); #endif
Color enums
| BLACK | - Standard black |
| RED | - Standard red |
| GREEN | - Standard green |
| YELLOW | - Standard yellow |
| BLUE | - Standard blue |
| MAGENTA | - Standard magenta |
| CYAN | - Standard cyan |
| WHITE | - Standard white |
| BRIGHTBLACK | - Bold black |
| BRIGHTRED | - Bold red |
| BRIGHTGREEN | - Bold green |
| BRIGHTYELLOW | - Bold yellow |
| BRIGHTBLUE | - Bold blue |
| BRIGHTMAGENTA | - Bold magenta |
| BRIGHTCYAN | - Bold cyan |
| BRIGHTWHITE | - Bold white |
severity type
| debug | - debug level of logging |
| info | - information level of logging |
| warning | - warning level of logging |
| error | - error level of logging |
| fatal | - fatal level of logging |
| pass | - PASS banner level of logging |
| Enumerator | |
|---|---|
| debug | information level of logging |
| info | debug level of logging |
| warning | warning level of logging |
| error | error level of logging |
| fatal | fatal level of logging |
| pass | PASS banner. |
|
explicit |
logger class
| name | - name of the output log file |
| logstdout | - print logging to stdout as well as file |
| loglvl | - From severity_t (default: severity_t::info) |
| debugclr | - Color for the DEBUG messages (default: MAGENTA) |
| infoclr | - Color for the INFO messages (default: BLACK) |
| warningclr | - Color for the WARN messages (default: YELLOW) |
| errorclr | - Color for the ERROR messages (default:RED) |
| fatalclr | - Color for the FATAL messages (default:RED) |
| passclr | - Color for the PASS messages (default:GREEN) |
| jlogger::asciicolor InterfacePP::jlogger::get_color | ( | std::string | color | ) |
Obtain current color for logging field
| color | - Color to set values are DEBUGCLR, INFOCLR, WARNCLR, ERRCLR, FATALCLR, PASSCLR |
| severity_t InterfacePP::jlogger::get_loglvl | ( | ) |
get the loggging level
| void InterfacePP::jlogger::print | ( | Args... | args | ) |
print function for logger
| Args...args | - variable number of arguments to print |
| void InterfacePP::jlogger::set_color | ( | std::string | color, |
| jlogger::asciicolor | jcolor | ||
| ) |
Change colors for the logging output
| color | - Color to set values are DEBUGCLR, INFOCLR, WARNCLR, ERRCLR, FATALCLR, PASSCLR |
| jcolor | - Enum value of new color |
| void InterfacePP::jlogger::set_loglvl | ( | severity_t | newlvl | ) |
set the loggging level
| newlvl | - new logging level |
|
static |
Convert jlogger::asciicolor Enum to a ASCII color code string
| jcolor | - Enum to convert |
|
static |
Convert string to jlogger::asciicolor Enum
| color | - Color to convert |
|
static |
Convert jlogger::asciicolor Enum to a string representation
| jcolor | - Enum to convert |