TkN 2.1
Toolkit for Nuclei
tklog Class Reference

Classe used to print debugs, infos, warnings and errors into the terminal. More...

Detailed Description

Classe used to print debugs, infos, warnings and errors into the terminal.

Definition at line 54 of file tklog.h.

#include <tklog.h>

Public Types

enum  bColor {
  kBlack = 0 , kRed = 1 , kGreen = 2 , kYellow = 3 ,
  kBlue = 4 , kPurple = 5 , kCyan = 6 , kWhite = 7 ,
  kDefault_color = 8
}
 
enum  bType {
  kRegular = 0 , kBold = 1 , kItalic = 3 , kUnderline = 4 ,
  kBlink = 5
}
 
enum  log_level { kinfo , kwarning , kerror , knone }
 

Public Member Functions

 tklog ()
 
virtual ~tklog ()
 
void clear ()
 
tklogoperator<< (std::basic_ostream< char > o)
 
template<class T >
tklogoperator<< (T t)
 send any request to the underlying ostringstream More...
 
virtual tklogoperator<< (tklog &(*pf)(tklog &))
 To allow manipulators. More...
 
void progress_bar (int _max, int _value, const tkstring &_message="")
 
void set_class (tkstring _class_name)
 
void set_log_level (log_level _level)
 
void set_method (tkstring _method_name)
 
void set_warnings (bool _print_warnings=true)
 

Static Public Member Functions

static tklogthe_log ()
 glog is a singleton used for fancy prints in the terminal More...
 

Public Attributes

bColor fBG_color = kDefault_color
 
tkstring fClass {}
 To put back the standard font in std::cout. More...
 
std::ostringstream fCore_message {}
 Contains the type string to be printed with the current style. More...
 
bColor fFG_color = kDefault_color
 
std::ostringstream fHeader {}
 Contains the core message string to be printed with the current style. More...
 
bool fHigh_intensity_colors = false
 
log_level flog_level = kinfo
 
tkstring fMethod {}
 
bool fprint_warnings = true
 
std::ostringstream fType_message {}
 
tkstring fTypes = ""
 

Static Public Attributes

static const tkstring freset_font = "\e[0m"
 Contains the style (color + type) More...
 

Friends

tklogblack (tklog &)
 
tklogblack_bg (tklog &)
 
tklogblink (tklog &)
 
tklogblue (tklog &)
 
tklogblue_bg (tklog &)
 
tklogbold (tklog &)
 
tklogcomment (tklog &)
 
tklogcyan (tklog &)
 
tklogcyan_bg (tklog &)
 
tklogdebug (tklog &log)
 
tklogdo_endl (tklog &)
 General. More...
 
tklogdo_header (tklog &)
 Reimplementation of std::endl. More...
 
tklogdo_log (tklog &)
 To print the current message, then reset the log. More...
 
tklogerror (tklog &)
 
tklogerror_o (tklog &)
 
tklogerror_v (tklog &)
 
tklogerror_vo (tklog &)
 
tkloggreen (tklog &)
 
tkloggreen_bg (tklog &)
 
tkloghigh_intensity (tklog &)
 Colors. More...
 
tkloginfo (tklog &)
 
tkloginfo_o (tklog &)
 
tkloginfo_v (tklog &)
 Predefined macros with verbose option (print the name of the class and method) More...
 
tkloginfo_vo (tklog &)
 
tklogitalic (tklog &)
 
tklogpurple (tklog &)
 
tklogpurple_bg (tklog &)
 
tklogred (tklog &)
 
tklogred_bg (tklog &)
 
tklogregular (tklog &)
 Attributes. More...
 
tklogreset (tklog &)
 To print the current message, then reset the log. More...
 
tklogskip_line (tklog &)
 Reset the log style. More...
 
tklogunderline (tklog &)
 
tklogwarning (tklog &)
 
tklogwarning_o (tklog &)
 
tklogwarning_v (tklog &)
 
tklogwarning_vo (tklog &)
 
tklogwhite (tklog &)
 
tklogwhite_bg (tklog &)
 
tklogyellow (tklog &)
 
tklogyellow_bg (tklog &)
 

Member Enumeration Documentation

◆ bColor

enum bColor
Enumerator
kBlack 
kRed 
kGreen 
kYellow 
kBlue 
kPurple 
kCyan 
kWhite 
kDefault_color 

Definition at line 135 of file tklog.h.

◆ bType

enum bType
Enumerator
kRegular 
kBold 
kItalic 
kUnderline 
kBlink 

Definition at line 147 of file tklog.h.

◆ log_level

enum log_level
Enumerator
kinfo 
kwarning 
kerror 
knone 

Definition at line 125 of file tklog.h.

Constructor & Destructor Documentation

◆ tklog()

tklog ( )
inline

Definition at line 167 of file tklog.h.

◆ ~tklog()

virtual ~tklog ( )
inlinevirtual

Definition at line 168 of file tklog.h.

Member Function Documentation

◆ clear()

void clear ( )
inline

Definition at line 179 of file tklog.h.

◆ operator<<() [1/3]

tklog & operator<< ( std::basic_ostream< char >  o)
inline

Definition at line 192 of file tklog.h.

◆ operator<<() [2/3]

tklog & operator<< ( t)
inline

send any request to the underlying ostringstream

Definition at line 186 of file tklog.h.

◆ operator<<() [3/3]

virtual tklog & operator<< ( tklog &(*)(tklog &)  pf)
inlinevirtual

To allow manipulators.

Definition at line 182 of file tklog.h.

◆ progress_bar()

void progress_bar ( int  _max,
int  _value,
const tkstring _message = "" 
)

Definition at line 64 of file tklog.cpp.

◆ set_class()

void set_class ( tkstring  _class_name)
inline

Definition at line 170 of file tklog.h.

◆ set_log_level()

void set_log_level ( log_level  _level)
inline

Definition at line 175 of file tklog.h.

◆ set_method()

void set_method ( tkstring  _method_name)
inline

Definition at line 171 of file tklog.h.

◆ set_warnings()

void set_warnings ( bool  _print_warnings = true)
inline

Definition at line 176 of file tklog.h.

◆ the_log()

tklog * the_log ( )
static

glog is a singleton used for fancy prints in the terminal

Definition at line 55 of file tklog.cpp.

Friends And Related Function Documentation

◆ black

tklog & black ( tklog log)
friend

Definition at line 258 of file tklog.h.

◆ black_bg

tklog & black_bg ( tklog log)
friend

Definition at line 283 of file tklog.h.

◆ blink

tklog & blink ( tklog log)
friend

Definition at line 321 of file tklog.h.

◆ blue

tklog & blue ( tklog log)
friend

Definition at line 270 of file tklog.h.

◆ blue_bg

tklog & blue_bg ( tklog log)
friend

Definition at line 295 of file tklog.h.

◆ bold

tklog & bold ( tklog log)
friend

Definition at line 312 of file tklog.h.

◆ comment

tklog & comment ( tklog log)
friend

Definition at line 342 of file tklog.h.

◆ cyan

tklog & cyan ( tklog log)
friend

Definition at line 276 of file tklog.h.

◆ cyan_bg

tklog & cyan_bg ( tklog log)
friend

Definition at line 301 of file tklog.h.

◆ debug

tklog & debug ( tklog log)
friend

Definition at line 373 of file tklog.h.

◆ do_endl

tklog & do_endl ( tklog log)
friend

General.

Definition at line 235 of file tklog.h.

◆ do_header

tklog & do_header ( tklog log)
friend

Reimplementation of std::endl.

Definition at line 212 of file tklog.h.

◆ do_log

tklog & do_log ( tklog log)
friend

To print the current message, then reset the log.

Definition at line 222 of file tklog.h.

◆ error

tklog & error ( tklog log)
friend

Definition at line 367 of file tklog.h.

◆ error_o

tklog & error_o ( tklog log)
friend

Definition at line 361 of file tklog.h.

◆ error_v

tklog & error_v ( tklog log)
friend

Definition at line 430 of file tklog.h.

◆ error_vo

tklog & error_vo ( tklog log)
friend

Definition at line 420 of file tklog.h.

◆ green

tklog & green ( tklog log)
friend

Definition at line 264 of file tklog.h.

◆ green_bg

tklog & green_bg ( tklog log)
friend

Definition at line 289 of file tklog.h.

◆ high_intensity

tklog & high_intensity ( tklog log)
friend

Colors.

Definition at line 255 of file tklog.h.

◆ info

tklog & info ( tklog log)
friend

Definition at line 336 of file tklog.h.

◆ info_o

tklog & info_o ( tklog log)
friend

Definition at line 331 of file tklog.h.

◆ info_v

tklog & info_v ( tklog log)
friend

Predefined macros with verbose option (print the name of the class and method)

Definition at line 388 of file tklog.h.

◆ info_vo

tklog & info_vo ( tklog log)
friend

Definition at line 378 of file tklog.h.

◆ italic

tklog & italic ( tklog log)
friend

Definition at line 315 of file tklog.h.

◆ purple

tklog & purple ( tklog log)
friend

Definition at line 273 of file tklog.h.

◆ purple_bg

tklog & purple_bg ( tklog log)
friend

Definition at line 298 of file tklog.h.

◆ red

tklog & red ( tklog log)
friend

Definition at line 261 of file tklog.h.

◆ red_bg

tklog & red_bg ( tklog log)
friend

Definition at line 286 of file tklog.h.

◆ regular

tklog & regular ( tklog log)
friend

Attributes.

Definition at line 309 of file tklog.h.

◆ reset

tklog & reset ( tklog log)
friend

To print the current message, then reset the log.

Definition at line 249 of file tklog.h.

◆ skip_line

tklog & skip_line ( tklog log)
friend

Reset the log style.

Predefined macros

Definition at line 326 of file tklog.h.

◆ underline

tklog & underline ( tklog log)
friend

Definition at line 318 of file tklog.h.

◆ warning

tklog & warning ( tklog log)
friend

Definition at line 354 of file tklog.h.

◆ warning_o

tklog & warning_o ( tklog log)
friend

Definition at line 348 of file tklog.h.

◆ warning_v

tklog & warning_v ( tklog log)
friend

Definition at line 409 of file tklog.h.

◆ warning_vo

tklog & warning_vo ( tklog log)
friend

Definition at line 398 of file tklog.h.

◆ white

tklog & white ( tklog log)
friend

Definition at line 279 of file tklog.h.

◆ white_bg

tklog & white_bg ( tklog log)
friend

Definition at line 304 of file tklog.h.

◆ yellow

tklog & yellow ( tklog log)
friend

Definition at line 267 of file tklog.h.

◆ yellow_bg

tklog & yellow_bg ( tklog log)
friend

Definition at line 292 of file tklog.h.

Member Data Documentation

◆ fBG_color

bColor fBG_color = kDefault_color

Definition at line 156 of file tklog.h.

◆ fClass

tkstring fClass {}

To put back the standard font in std::cout.

Definition at line 132 of file tklog.h.

◆ fCore_message

std::ostringstream fCore_message {}

Contains the type string to be printed with the current style.

Definition at line 128 of file tklog.h.

◆ fFG_color

bColor fFG_color = kDefault_color

Definition at line 155 of file tklog.h.

◆ fHeader

std::ostringstream fHeader {}

Contains the core message string to be printed with the current style.

Definition at line 129 of file tklog.h.

◆ fHigh_intensity_colors

bool fHigh_intensity_colors = false

Definition at line 158 of file tklog.h.

◆ flog_level

log_level flog_level = kinfo

Definition at line 160 of file tklog.h.

◆ fMethod

tkstring fMethod {}

Definition at line 133 of file tklog.h.

◆ fprint_warnings

bool fprint_warnings = true

Definition at line 161 of file tklog.h.

◆ freset_font

const tkstring freset_font = "\e[0m"
static

Contains the style (color + type)

Definition at line 130 of file tklog.h.

◆ fType_message

std::ostringstream fType_message {}

Definition at line 127 of file tklog.h.

◆ fTypes

tkstring fTypes = ""

Definition at line 157 of file tklog.h.


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