summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2025-04-15 18:29:33 -0400
committerGlenn Smith <glenn@vector35.com>2025-04-16 16:20:43 -0400
commit6048009821540158204514940210999152088083 (patch)
treeb6b463e75511ed880359786b724bf06c8d1b7c89 /binaryninjaapi.h
parentb2ec34ae9b5b78efa735804c103c112aa77a0823 (diff)
Fix Logger indentation api
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h32
1 files changed, 32 insertions, 0 deletions
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<std::string> GetLoggerNames();
};
+ /*! RAII helper that indents/dedents a Logger inside a scope
+ \ingroup logging
+ */
+ class LoggerIndentScope
+ {
+ Ref<Logger> m_logger;
+
+ public:
+ LoggerIndentScope(Ref<Logger> logger): m_logger(logger)
+ {
+ m_logger->Indent();
+ }
+ ~LoggerIndentScope()
+ {
+ m_logger->Dedent();
+ }
+ };
+
/*!
@addtogroup coreapi
@{