From 6048009821540158204514940210999152088083 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 15 Apr 2025 18:29:33 -0400 Subject: Fix Logger indentation api --- binaryninjaapi.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 2fe2ed09..9e7e9eff 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1057,9 +1057,23 @@ namespace BinaryNinja { */ size_t GetSessionId(); + /*! Indent the logger's indentation level by one + */ void Indent(); + + /*! Decrease the logger's indentation level by one + */ void Dedent(); + + /*! Set the logger's indentation level to zero + */ void ResetIndent(); + + /*! Get the string to prepend to log messages to indent them + + \return Indentation string + */ + std::string GetIndent() const; }; /*! A class allowing registering and retrieving Loggers @@ -1120,6 +1134,24 @@ namespace BinaryNinja { static std::vector GetLoggerNames(); }; + /*! RAII helper that indents/dedents a Logger inside a scope + \ingroup logging + */ + class LoggerIndentScope + { + Ref m_logger; + + public: + LoggerIndentScope(Ref logger): m_logger(logger) + { + m_logger->Indent(); + } + ~LoggerIndentScope() + { + m_logger->Dedent(); + } + }; + /*! @addtogroup coreapi @{ -- cgit v1.3.1