Protocol++® (Protocolpp®)  v5.6.2
InterfacePP::jlogger Class Reference

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_type {
  info =1 , debug , warning , error ,
  fatal , pass
}
 

Public Member Functions

 jlogger (const std::string &name, bool logstdout=false, int loglvl=3, jlogger::asciicolor debugclr=jlogger::asciicolor::MAGENTA, jlogger::asciicolor infoclr=jlogger::asciicolor::CYAN, jlogger::asciicolor warningclr=jlogger::asciicolor::YELLOW, jlogger::asciicolor errorclr=jlogger::asciicolor::RED, jlogger::asciicolor fatalclr=jlogger::asciicolor::RED, jlogger::asciicolor passclr=jlogger::asciicolor::GREEN)
 
template<typename jlogger::severity_type , typename... Args>
void print (Args...args)
 
 ~jlogger ()
 standard deconstructor
 
void set_loglvl (int newlvl)
 
void set_color (std::string color, jlogger::asciicolor jcolor)
 
int 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)
 

Member Enumeration Documentation

◆ asciicolor

Color enums

Parameters
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
Enumerator
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

severity type

Parameters
info- information level of logging
debug- debug 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
info 

information level of logging

debug 

debug level of logging

warning 

warning level of logging

error 

error level of logging

fatal 

fatal level of logging

pass 

PASS banner.

Constructor & Destructor Documentation

◆ jlogger()

InterfacePP::jlogger::jlogger ( const std::string &  name,
bool  logstdout = false,
int  loglvl = 3,
jlogger::asciicolor  debugclr = jlogger::asciicolor::MAGENTA,
jlogger::asciicolor  infoclr = jlogger::asciicolor::CYAN,
jlogger::asciicolor  warningclr = jlogger::asciicolor::YELLOW,
jlogger::asciicolor  errorclr = jlogger::asciicolor::RED,
jlogger::asciicolor  fatalclr = jlogger::asciicolor::RED,
jlogger::asciicolor  passclr = jlogger::asciicolor::GREEN 
)
explicit

logger class

Parameters
name- name of the output log file
logstdout- print logging to stdout as well as file
loglvl- Level of logging (4-<DEBUG, INFO, WARN, ERROR, FATAL, PASS>, 3[default]-<INFO, WARN, ERROR, FATAL, PASS>, 2-<WARN, ERROR, FATAL, PASS>, 1-<ERROR, FATAL, PASS>, 0-NO LOGGING)
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)

Member Function Documentation

◆ get_color()

jlogger::asciicolor InterfacePP::jlogger::get_color ( std::string  color)

Obtain current color for logging field

Parameters
color- Color to set values are DEBUGCLR, INFOCLR, WARNCLR, ERRCLR, FATALCLR, PASSCLR
Returns
Returns the jlogger::asciicolor Enum value of the color

◆ get_loglvl()

int InterfacePP::jlogger::get_loglvl ( )

get the loggging level

Returns
Returns the logging level

◆ print()

template<jlogger::severity_type severity, typename... Args>
void InterfacePP::jlogger::print ( Args...  args)

print function for logger

Parameters
Args...args- variable number of arguments to print

◆ set_color()

void InterfacePP::jlogger::set_color ( std::string  color,
jlogger::asciicolor  jcolor 
)

Change colors for the logging output

Parameters
color- Color to set values are DEBUGCLR, INFOCLR, WARNCLR, ERRCLR, FATALCLR, PASSCLR
jcolor- Enum value of new color

◆ set_loglvl()

void InterfacePP::jlogger::set_loglvl ( int  newlvl)

set the loggging level

Parameters
newlvl- new logging level

◆ toCode()

static std::string InterfacePP::jlogger::toCode ( jlogger::asciicolor  jcolor)
static

Convert jlogger::asciicolor Enum to a ASCII color code string

Parameters
jcolor- Enum to convert
Returns
ASCII color code string

◆ toEnum()

static jlogger::asciicolor InterfacePP::jlogger::toEnum ( std::string  color)
static

Convert string to jlogger::asciicolor Enum

Parameters
color- Color to convert
Returns
Returns the jlogger::asciicolor Enum value of the color

◆ toStr()

static std::string InterfacePP::jlogger::toStr ( jlogger::asciicolor  jcolor)
static

Convert jlogger::asciicolor Enum to a string representation

Parameters
jcolor- Enum to convert
Returns
Returns the string name of the color

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