logging: add a LoggerDB::getConfig() method
[folly.git] / folly / experimental / logging / LoggerDB.h
index c2c1d423f226016a6cf2b5a95c6fa6ca746fbb6e..d65324f7ce004bc5154f89fc169c2078e9dee92c 100644 (file)
@@ -29,6 +29,7 @@
 namespace folly {
 
 class LogCategory;
+class LogConfig;
 class LogHandler;
 class LogHandlerFactory;
 enum class LogLevel : uint32_t;
@@ -76,6 +77,17 @@ class LoggerDB {
   void setLevel(folly::StringPiece name, LogLevel level, bool inherit = true);
   void setLevel(LogCategory* category, LogLevel level, bool inherit = true);
 
+  /**
+   * Get a LogConfig object describing the current state of the LoggerDB.
+   *
+   * Note that this may not 100% accurately describe the current configuration
+   * if callers have manually added LogHandlers to some categories without
+   * using the updateConfig() or resetConfig() functions.  In this case
+   * getConfig() will simply report these handlers as "unknown_handler" when
+   * returning handler names for the categories in question.
+   */
+  LogConfig getConfig() const;
+
   /**
    * Apply a configuration string specifying a series a log levels.
    *