NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
newlang::Logger Class Reference

#include <logger.h>

Public Types

typedef uint8_t LogLevelType
 
typedef void FuncCallback(void *param, LogLevelType level, const char *str, bool flush)
 

Public Member Functions

LogLevelType GetLogLevel ()
 
LogLevelType GetLogLevelNormal ()
 
LogLevelType SetLogLevel (const LogLevelType level)
 
bool SetPrintCallstack (bool enable)
 
bool GetPrintCallstack ()
 
void SetCallback (FuncCallback *func, void *param)
 
void SaveCallback (FuncCallback *&func, void *&param)
 
const char * AddString (LogLevelType level, char const *string, bool flush)
 
 Logger ()
 
 Logger (const Logger &)=delete
 
const Loggeroperator= (const Logger &)=delete
 
virtual ~Logger ()
 

Static Public Member Functions

static std::string GetStackTrace ()
 
static void PrintfCallback (void *, LogLevelType, const char *str, bool flush)
 
static std::string log_printf (uint8_t level, char const *prefix, char const *file, int line, char const *format,...)
 
static const char * GetLogLevelDesc (LogLevelType level)
 
static LoggerInstance ()
 

Public Attributes

LogLevelType m_level
 
FuncCallbackm_func
 
void * m_func_param
 
bool m_print_callstack
 

Static Public Attributes

static Loggerm_instance = nullptr
 

Detailed Description

Definition at line 317 of file logger.h.

Member Typedef Documentation

◆ LogLevelType

Definition at line 319 of file logger.h.

◆ FuncCallback

typedef void newlang::Logger::FuncCallback(void *param, LogLevelType level, const char *str, bool flush)

Definition at line 320 of file logger.h.

Constructor & Destructor Documentation

◆ Logger() [1/2]

newlang::Logger::Logger ( )
inline

Definition at line 386 of file logger.h.

References LOG_LEVEL_NORMAL, m_func, m_func_param, m_level, m_print_callstack, and PrintfCallback().

Referenced by Instance().

◆ Logger() [2/2]

newlang::Logger::Logger ( const Logger & )
delete

◆ ~Logger()

virtual newlang::Logger::~Logger ( )
inlinevirtual

Definition at line 395 of file logger.h.

Member Function Documentation

◆ GetLogLevel()

LogLevelType newlang::Logger::GetLogLevel ( )
inline

Definition at line 322 of file logger.h.

References m_level.

Referenced by log_printf(), newlang::Parser::PragmaEval(), and newlang::NLC::Run().

◆ GetLogLevelNormal()

LogLevelType newlang::Logger::GetLogLevelNormal ( )
inline

Definition at line 326 of file logger.h.

References LOG_LEVEL_NORMAL.

◆ SetLogLevel()

LogLevelType newlang::Logger::SetLogLevel ( const LogLevelType level)
inline

Definition at line 330 of file logger.h.

References LOG_LEVEL_ABORT, LOG_LEVEL_MAX, LOG_LEVEL_NORMAL, and m_level.

Referenced by newlang::Parser::PragmaEval().

◆ SetPrintCallstack()

bool newlang::Logger::SetPrintCallstack ( bool enable)
inline

Definition at line 340 of file logger.h.

References m_print_callstack.

◆ GetPrintCallstack()

bool newlang::Logger::GetPrintCallstack ( )
inline

Definition at line 346 of file logger.h.

References m_print_callstack.

◆ GetStackTrace()

std::string Logger::GetStackTrace ( )
static

Definition at line 2789 of file jit.cpp.

References result.

◆ PrintfCallback()

static void newlang::Logger::PrintfCallback ( void * ,
LogLevelType ,
const char * str,
bool flush )
inlinestatic

Definition at line 351 of file logger.h.

Referenced by Logger().

◆ SetCallback()

void newlang::Logger::SetCallback ( FuncCallback * func,
void * param )
inline

Definition at line 358 of file logger.h.

References m_func, and m_func_param.

Referenced by newlang::NLC::Run(), and newlang::NLC::~NLC().

◆ SaveCallback()

void newlang::Logger::SaveCallback ( FuncCallback *& func,
void *& param )
inline

Definition at line 363 of file logger.h.

References m_func, and m_func_param.

Referenced by newlang::NLC::Run().

◆ log_printf()

std::string Logger::log_printf ( uint8_t level,
char const * prefix,
char const * file,
int line,
char const * format,
... )
static

Definition at line 33 of file logger.cpp.

References GetLogLevel(), Instance(), LOG_LEVEL_DUMP, LOG_LEVEL_INFO, m_func, m_func_param, result, and VERIFY.

◆ AddString()

const char * newlang::Logger::AddString ( LogLevelType level,
char const * string,
bool flush )

◆ GetLogLevelDesc()

const char * Logger::GetLogLevelDesc ( LogLevelType level)
static

◆ Instance()

static Logger * newlang::Logger::Instance ( )
inlinestatic

◆ operator=()

const Logger & newlang::Logger::operator= ( const Logger & )
delete

Member Data Documentation

◆ m_instance

Logger * Logger::m_instance = nullptr
static

Definition at line 397 of file logger.h.

Referenced by Instance().

◆ m_level

LogLevelType newlang::Logger::m_level

Definition at line 398 of file logger.h.

Referenced by GetLogLevel(), Logger(), and SetLogLevel().

◆ m_func

FuncCallback* newlang::Logger::m_func

Definition at line 399 of file logger.h.

Referenced by log_printf(), Logger(), nlc_prinft_sub_(), SaveCallback(), and SetCallback().

◆ m_func_param

void* newlang::Logger::m_func_param

Definition at line 400 of file logger.h.

Referenced by log_printf(), Logger(), nlc_prinft_sub_(), SaveCallback(), and SetCallback().

◆ m_print_callstack

bool newlang::Logger::m_print_callstack

Definition at line 401 of file logger.h.

Referenced by GetPrintCallstack(), Logger(), and SetPrintCallstack().


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