X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=folly%2Fexperimental%2Flogging%2FLogCategory.h;h=6ea06cef48d7515b05a175b6f6093f815d91fe4d;hb=cd1bdc912603c0358ba733d379a74ae90ab3a437;hp=565373a7d6f2cc716f3df099ca32ad6233e95a74;hpb=b6e14b7b1823915a6891bd2fa622bca8f4c61004;p=folly.git diff --git a/folly/experimental/logging/LogCategory.h b/folly/experimental/logging/LogCategory.h index 565373a7..6ea06cef 100644 --- a/folly/experimental/logging/LogCategory.h +++ b/folly/experimental/logging/LogCategory.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-present Facebook, Inc. + * Copyright 2017-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -164,6 +164,26 @@ class LogCategory { */ std::vector> getHandlers() const; + /** + * Replace the list of LogHandlers with a completely new list. + */ + void replaceHandlers(std::vector> handlers); + + /** + * Update the LogHandlers attached to this LogCategory by replacing + * currently attached handlers with new LogHandler objects. + * + * The handlerMap argument is a map of (old_handler -> new_handler) + * If any of the LogHandlers currently attached to this category are found in + * the handlerMap, replace them with the new handler indicated in the map. + * + * This is used when the LogHandler configuration is changed requiring one or + * more LogHandler objects to be replaced with new ones. + */ + void updateHandlers(const std::unordered_map< + std::shared_ptr, + std::shared_ptr>& handlerMap); + /* Internal methods for use by other parts of the logging library code */ /** @@ -201,6 +221,12 @@ class LogCategory { private: enum : uint32_t { FLAG_INHERIT = 0x80000000 }; + // FLAG_INHERIT is the stored in the uppermost bit of the LogLevel field. + // assert that it does not conflict with valid LogLevel values. + static_assert( + static_cast(LogLevel::MAX_LEVEL) < FLAG_INHERIT, + "The FLAG_INHERIT bit must not be set in any valid LogLevel value"); + // Forbidden copy constructor and assignment operator LogCategory(LogCategory const&) = delete; LogCategory& operator=(LogCategory const&) = delete;