Arion 1.0.2-alpha
A high-performance C++ framework for emulating executable binaries.
 
Loading...
Searching...
No Matches
arion::Logger Class Reference

This class is responsible for managing logging in the Arion emulation framework. More...

#include <logger.hpp>

Public Member Functions

 Logger (std::weak_ptr< Arion > arion)
 
void set_log_level (LOG_LEVEL lvl)
 
LOG_LEVEL get_log_level ()
 
void trace (std::string str)
 
void debug (std::string str)
 
void info (std::string str)
 
void warn (std::string str)
 
void error (std::string str)
 
void critical (std::string str)
 

Static Public Member Functions

static std::unique_ptr< Loggerinitialize (std::weak_ptr< Arion > arion, LOG_LEVEL lvl=LOG_LEVEL::INFO)
 

Private Member Functions

void refresh_prefix (bool force=false)
 

Static Private Member Functions

static uint64_t gen_next_id ()
 Generates the next free logger ID.
 

Private Attributes

uint64_t id
 The unique identifier for this logger instance.
 
pid_t curr_pid
 The process ID of the current process.
 
pid_t curr_tid
 The thread ID of the current thread.
 
LOG_LEVEL log_lvl
 The current log level.
 
std::weak_ptr< Arionarion
 The Arion instance associated to this instance.
 
std::shared_ptr< void > logger
 The spdlog logger instance.
 

Static Private Attributes

static uint64_t curr_id
 The unique identifier for this logger instance.
 
static std::stack< uint64_t > free_logger_ids
 A stack of free logger IDs that can be reused.
 

Detailed Description

This class is responsible for managing logging in the Arion emulation framework.

Constructor & Destructor Documentation

◆ Logger()

arion::Logger::Logger ( std::weak_ptr< Arion arion)

Builder for Logger instances.

Parameters
[in]arionThe Arion instance associated with this instance.

Member Function Documentation

◆ critical()

void arion::Logger::critical ( std::string  str)

Logs a critical message.

Parameters
[in]strThe message to log.

◆ debug()

void arion::Logger::debug ( std::string  str)

Logs a debug message.

Parameters
[in]strThe message to log.

◆ error()

void arion::Logger::error ( std::string  str)

Logs an error message.

Parameters
[in]strThe message to log.

◆ gen_next_id()

static uint64_t arion::Logger::gen_next_id ( )
staticprivate

Generates the next free logger ID.

◆ get_log_level()

LOG_LEVEL arion::Logger::get_log_level ( )

Retrieves the current log level.

Returns
The current log level.

◆ info()

void arion::Logger::info ( std::string  str)

Logs an info message.

Parameters
[in]strThe message to log.

◆ initialize()

static std::unique_ptr< Logger > arion::Logger::initialize ( std::weak_ptr< Arion arion,
LOG_LEVEL  lvl = LOG_LEVEL::INFO 
)
static

Instanciates and initializes new Logger objects with some parameters.

Parameters
[in]arionThe Arion instance associated with this instance.
[in]lvlThe initial log level.
Returns
A new Logger instance.

◆ refresh_prefix()

void arion::Logger::refresh_prefix ( bool  force = false)
private

Refreshes the log prefix if needed.

Parameters
[in]forceTrue if the prefix should be reloaded in all cases.

◆ set_log_level()

void arion::Logger::set_log_level ( LOG_LEVEL  lvl)

Defines the log level.

Parameters
[in]lvlThe new log level.

◆ trace()

void arion::Logger::trace ( std::string  str)

Logs a trace message.

Parameters
[in]strThe message to log.

◆ warn()

void arion::Logger::warn ( std::string  str)

Logs a warning message.

Parameters
[in]strThe message to log.

Member Data Documentation

◆ arion

std::weak_ptr<Arion> arion::Logger::arion
private

The Arion instance associated to this instance.

◆ curr_id

uint64_t arion::Logger::curr_id
staticprivate

The unique identifier for this logger instance.

◆ curr_pid

pid_t arion::Logger::curr_pid
private

The process ID of the current process.

◆ curr_tid

pid_t arion::Logger::curr_tid
private

The thread ID of the current thread.

◆ free_logger_ids

std::stack<uint64_t> arion::Logger::free_logger_ids
staticprivate

A stack of free logger IDs that can be reused.

◆ id

uint64_t arion::Logger::id
private

The unique identifier for this logger instance.

◆ log_lvl

LOG_LEVEL arion::Logger::log_lvl
private

The current log level.

◆ logger

std::shared_ptr<void> arion::Logger::logger
private

The spdlog logger instance.


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