TkN 2.6
Toolkit for Nuclei
Loading...
Searching...
No Matches
tklog Class Reference

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

#include <base/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
 
virtual tklogoperator<< (tklog &(*pf)(tklog &))
 To allow manipulators.
 
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
 

Public Attributes

bColor fBG_color = kDefault_color
 
tkstring fClass {}
 To put back the standard font in std::cout.
 
std::ostringstream fCore_message {}
 Contains the type string to be printed with the current style.
 
bColor fFG_color = kDefault_color
 
std::ostringstream fHeader {}
 Contains the core message string to be printed with the current style.
 
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)
 

Friends

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

Detailed Description

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

Definition at line 31 of file tklog.h.

Member Enumeration Documentation

◆ bColor

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

Definition at line 112 of file tklog.h.

◆ bType

enum bType
Enumerator
kRegular 
kBold 
kItalic 
kUnderline 
kBlink 

Definition at line 124 of file tklog.h.

◆ log_level

enum log_level
Enumerator
kinfo 
kwarning 
kerror 
knone 

Definition at line 102 of file tklog.h.

Constructor & Destructor Documentation

◆ tklog()

tklog ( )
inline

Definition at line 144 of file tklog.h.

◆ ~tklog()

virtual ~tklog ( )
inlinevirtual

Definition at line 145 of file tklog.h.

Member Function Documentation

◆ clear()

void clear ( )
inline

Definition at line 156 of file tklog.h.

◆ operator<<() [1/3]

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

Definition at line 169 of file tklog.h.

◆ operator<<() [2/3]

template<class T>
tklog & operator<< ( T t)
inline

send any request to the underlying ostringstream

Definition at line 163 of file tklog.h.

◆ operator<<() [3/3]

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

To allow manipulators.

Definition at line 159 of file tklog.h.

◆ progress_bar()

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

Definition at line 41 of file tklog.cpp.

◆ set_class()

void set_class ( tkstring _class_name)
inline

Definition at line 147 of file tklog.h.

◆ set_log_level()

void set_log_level ( log_level _level)
inline

Definition at line 152 of file tklog.h.

◆ set_method()

void set_method ( tkstring _method_name)
inline

Definition at line 148 of file tklog.h.

◆ set_warnings()

void set_warnings ( bool _print_warnings = true)
inline

Definition at line 153 of file tklog.h.

◆ the_log()

tklog * the_log ( )
static

glog is a singleton used for fancy prints in the terminal

Definition at line 32 of file tklog.cpp.

Friends And Related Symbol Documentation

◆ black

tklog & black ( tklog & log)
friend

Definition at line 235 of file tklog.h.

◆ black_bg

tklog & black_bg ( tklog & log)
friend

Definition at line 260 of file tklog.h.

◆ blink

tklog & blink ( tklog & log)
friend

Definition at line 298 of file tklog.h.

◆ blue

tklog & blue ( tklog & log)
friend

Definition at line 247 of file tklog.h.

◆ blue_bg

tklog & blue_bg ( tklog & log)
friend

Definition at line 272 of file tklog.h.

◆ bold

tklog & bold ( tklog & log)
friend

Definition at line 289 of file tklog.h.

◆ comment

tklog & comment ( tklog & log)
friend

Definition at line 319 of file tklog.h.

◆ cyan

tklog & cyan ( tklog & log)
friend

Definition at line 253 of file tklog.h.

◆ cyan_bg

tklog & cyan_bg ( tklog & log)
friend

Definition at line 278 of file tklog.h.

◆ debug

tklog & debug ( tklog & log)
friend

Definition at line 350 of file tklog.h.

◆ do_endl

tklog & do_endl ( tklog & log)
friend

General.

Definition at line 212 of file tklog.h.

◆ do_header

tklog & do_header ( tklog & log)
friend

Reimplementation of std::endl.

Definition at line 189 of file tklog.h.

◆ do_log

tklog & do_log ( tklog & log)
friend

To print the current message, then reset the log.

Definition at line 199 of file tklog.h.

◆ error

tklog & error ( tklog & log)
friend

Definition at line 344 of file tklog.h.

◆ error_o

tklog & error_o ( tklog & log)
friend

Definition at line 338 of file tklog.h.

◆ error_v

tklog & error_v ( tklog & log)
friend

Definition at line 407 of file tklog.h.

◆ error_vo

tklog & error_vo ( tklog & log)
friend

Definition at line 397 of file tklog.h.

◆ green

tklog & green ( tklog & log)
friend

Definition at line 241 of file tklog.h.

◆ green_bg

tklog & green_bg ( tklog & log)
friend

Definition at line 266 of file tklog.h.

◆ high_intensity

tklog & high_intensity ( tklog & log)
friend

Colors.

Definition at line 232 of file tklog.h.

◆ info

tklog & info ( tklog & log)
friend

Definition at line 313 of file tklog.h.

◆ info_o

tklog & info_o ( tklog & log)
friend

Definition at line 308 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 365 of file tklog.h.

◆ info_vo

tklog & info_vo ( tklog & log)
friend

Definition at line 355 of file tklog.h.

◆ italic

tklog & italic ( tklog & log)
friend

Definition at line 292 of file tklog.h.

◆ purple

tklog & purple ( tklog & log)
friend

Definition at line 250 of file tklog.h.

◆ purple_bg

tklog & purple_bg ( tklog & log)
friend

Definition at line 275 of file tklog.h.

◆ red

tklog & red ( tklog & log)
friend

Definition at line 238 of file tklog.h.

◆ red_bg

tklog & red_bg ( tklog & log)
friend

Definition at line 263 of file tklog.h.

◆ regular

tklog & regular ( tklog & log)
friend

Attributes.

Definition at line 286 of file tklog.h.

◆ reset

tklog & reset ( tklog & log)
friend

To print the current message, then reset the log.

Definition at line 226 of file tklog.h.

◆ skip_line

tklog & skip_line ( tklog & log)
friend

Reset the log style.

Predefined macros

Definition at line 303 of file tklog.h.

◆ underline

tklog & underline ( tklog & log)
friend

Definition at line 295 of file tklog.h.

◆ warning

tklog & warning ( tklog & log)
friend

Definition at line 331 of file tklog.h.

◆ warning_o

tklog & warning_o ( tklog & log)
friend

Definition at line 325 of file tklog.h.

◆ warning_v

tklog & warning_v ( tklog & log)
friend

Definition at line 386 of file tklog.h.

◆ warning_vo

tklog & warning_vo ( tklog & log)
friend

Definition at line 375 of file tklog.h.

◆ white

tklog & white ( tklog & log)
friend

Definition at line 256 of file tklog.h.

◆ white_bg

tklog & white_bg ( tklog & log)
friend

Definition at line 281 of file tklog.h.

◆ yellow

tklog & yellow ( tklog & log)
friend

Definition at line 244 of file tklog.h.

◆ yellow_bg

tklog & yellow_bg ( tklog & log)
friend

Definition at line 269 of file tklog.h.

Member Data Documentation

◆ fBG_color

bColor fBG_color = kDefault_color

Definition at line 133 of file tklog.h.

◆ fClass

tkstring fClass {}

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

Definition at line 109 of file tklog.h.

◆ fCore_message

std::ostringstream fCore_message {}

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

Definition at line 105 of file tklog.h.

◆ fFG_color

bColor fFG_color = kDefault_color

Definition at line 132 of file tklog.h.

◆ fHeader

std::ostringstream fHeader {}

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

Definition at line 106 of file tklog.h.

◆ fHigh_intensity_colors

bool fHigh_intensity_colors = false

Definition at line 135 of file tklog.h.

◆ flog_level

log_level flog_level = kinfo

Definition at line 137 of file tklog.h.

◆ fMethod

tkstring fMethod {}

Definition at line 110 of file tklog.h.

◆ fprint_warnings

bool fprint_warnings = true

Definition at line 138 of file tklog.h.

◆ freset_font

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

Contains the style (color + type)

Definition at line 107 of file tklog.h.

◆ fType_message

std::ostringstream fType_message {}

Definition at line 104 of file tklog.h.

◆ fTypes

tkstring fTypes = ""

Definition at line 134 of file tklog.h.


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