ArkScript
A small, fast, functional and scripting language for video games
Ark::internal::Logger Class Reference

#include <Logger.hpp>

Collaboration diagram for Ark::internal::Logger:
[legend]

Public Member Functions

 Logger (std::string name, unsigned debug_level)
 Construct a new Logger object.
 
unsigned debugLevel () const
 
bool shouldInfo () const
 
bool shouldDebug () const
 
bool shouldTrace () const
 
template<typename... Args>
void info (const char *fmt, Args &&... args)
 Write an info level log using fmtlib.
 
template<typename... Args>
void debug (const char *fmt, Args &&... args)
 Write a debug level log using fmtlib.
 
void traceStart (std::string &&trace_name)
 
void traceEnd ()
 
template<typename... Args>
void trace (const char *fmt, Args &&... args)
 Write a trace level log using fmtlib.
 

Private Attributes

unsigned m_debug
 
std::string m_name
 
fmt::color m_pass_color
 
std::unordered_map< std::string, std::chrono::time_point< std::chrono::high_resolution_clock > > m_trace_starts
 
std::vector< std::string > m_active_traces
 

Detailed Description

Definition at line 24 of file Logger.hpp.

Constructor & Destructor Documentation

◆ Logger()

Ark::internal::Logger::Logger ( std::string name,
unsigned debug_level )

Construct a new Logger object.

Parameters
namethe pass name, used for logging
debug_leveldebug level

Definition at line 29 of file Logger.cpp.

References Ark::internal::colors, m_name, and m_pass_color.

Member Function Documentation

◆ debug()

template<typename... Args>
void Ark::internal::Logger::debug ( const char * fmt,
Args &&... args )
inline

Write a debug level log using fmtlib.

Template Parameters
Args
Parameters
fmtformat string
args

Definition at line 65 of file Logger.hpp.

References m_name, m_pass_color, and shouldDebug().

Referenced by Ark::internal::ImportSolver::process(), Ark::internal::MacroProcessor::process(), and Ark::internal::Optimizer::pruneUnusedGlobalVariables().

◆ debugLevel()

unsigned Ark::internal::Logger::debugLevel ( ) const
inlinenodiscard

Definition at line 35 of file Logger.hpp.

References m_debug.

◆ info()

template<typename... Args>
void Ark::internal::Logger::info ( const char * fmt,
Args &&... args )
inline

Write an info level log using fmtlib.

Template Parameters
Args
Parameters
fmtformat string
args

Definition at line 48 of file Logger.hpp.

References m_name, m_pass_color, and shouldInfo().

Referenced by Ark::Welder::saveBytecodeToFile().

◆ shouldDebug()

bool Ark::internal::Logger::shouldDebug ( ) const
inlinenodiscard

Definition at line 38 of file Logger.hpp.

References m_debug.

Referenced by debug().

◆ shouldInfo()

bool Ark::internal::Logger::shouldInfo ( ) const
inlinenodiscard

Definition at line 37 of file Logger.hpp.

References m_debug.

Referenced by info().

◆ shouldTrace()

bool Ark::internal::Logger::shouldTrace ( ) const
inlinenodiscard

◆ trace()

template<typename... Args>
void Ark::internal::Logger::trace ( const char * fmt,
Args &&... args )
inline

Write a trace level log using fmtlib.

Template Parameters
Args
Parameters
fmtformat string
args

Definition at line 98 of file Logger.hpp.

References m_name, m_pass_color, and shouldTrace().

Referenced by Ark::internal::MacroProcessor::process(), Ark::internal::NameResolutionPass::process(), Ark::internal::Optimizer::process(), and traceEnd().

◆ traceEnd()

◆ traceStart()

Member Data Documentation

◆ m_active_traces

std::vector<std::string> Ark::internal::Logger::m_active_traces
private

Definition at line 113 of file Logger.hpp.

Referenced by traceEnd(), and traceStart().

◆ m_debug

unsigned Ark::internal::Logger::m_debug
private

Definition at line 109 of file Logger.hpp.

Referenced by debugLevel(), shouldDebug(), shouldInfo(), and shouldTrace().

◆ m_name

std::string Ark::internal::Logger::m_name
private

Definition at line 110 of file Logger.hpp.

Referenced by debug(), info(), Logger(), and trace().

◆ m_pass_color

fmt::color Ark::internal::Logger::m_pass_color
private

Definition at line 111 of file Logger.hpp.

Referenced by debug(), info(), Logger(), and trace().

◆ m_trace_starts

std::unordered_map<std::string, std::chrono::time_point<std::chrono::high_resolution_clock> > Ark::internal::Logger::m_trace_starts
private

Definition at line 112 of file Logger.hpp.

Referenced by traceEnd(), and traceStart().


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