Logging

This section details the API to interact with LIEF’s logging engine.

LIEF relies on spdlog for logging mechansim and this API provides an abstraction over the implementation.

API

C++

void LIEF::logging::disable()

Globally disable the logging module.

void LIEF::logging::enable()

Globally enable the logging module.

void LIEF::logging::set_level(LEVEL level)

Change the logging level (hierarchical)

void LIEF::logging::set_path(const std::string &path)

Change the logger as a file-base logging and set its path.

template<typename ...Args>
void LIEF::logging::log(LEVEL level, const std::string &fmt, const Args&... args)
void LIEF::logging::log(LEVEL level, const std::string &fmt, const std::vector<std::string> &args)
void LIEF::logging::log(LEVEL level, const std::string &msg)

Log a message with the LIEF’s logger.

void LIEF::logging::reset()
enum class LIEF::logging::LEVEL : uint32_t

Hierarchical logging level

From a given level set, all levels below this ! level are enabled

For example, if LEVEL::INFO is enabled then LEVEL::WARN, LEVEL::ERR are also enabled

Values:

enumerator OFF = 0
enumerator TRACE
enumerator DEBUG
enumerator INFO
enumerator WARN
enumerator ERR
enumerator CRITICAL
class Scoped

Public Functions

Scoped(const Scoped&) = delete
Scoped &operator=(const Scoped&) = delete
Scoped(Scoped&&) = delete
Scoped &operator=(Scoped&&) = delete
inline explicit Scoped(LEVEL level)
inline const Scoped &set_level(LEVEL lvl) const
inline ~Scoped()

Python

lief.logging.set_level(level: lief.logging.LEVEL) None

Change logging level

lief.logging.enable() None

Enable the logger globally

lief.logging.disable() None

Disable the logger globally

lief.logging.set_path(path: str) None

Change the logger as a file-base logging and set its path

lief.logging.log(level: lief.logging.LEVEL, msg: str) None

Log a message with the LIEF’s logger

class lief.logging.LEVEL

Bases: object

CRITICAL = lief._lief.logging.LEVEL.CRITICAL
DEBUG = lief._lief.logging.LEVEL.DEBUG
ERROR = lief._lief.logging.LEVEL.ERROR
INFO = lief._lief.logging.LEVEL.INFO
OFF = lief._lief.logging.LEVEL.OFF
TRACE = lief._lief.logging.LEVEL.TRACE
WARN = lief._lief.logging.LEVEL.WARN