#include <folly/experimental/logging/LogName.h>
#include <folly/json.h>
#include <folly/lang/SafeAssert.h>
-#include <cassert>
using std::shared_ptr;
using std::string;
// Split the configString into level and handler information.
std::vector<StringPiece> handlerPieces;
folly::split(":", configString, handlerPieces);
- // folly::split() always returns a list of length 1
- assert(handlerPieces.size() >= 1);
+ FOLLY_SAFE_DCHECK(
+ handlerPieces.size() >= 1,
+ "folly::split() always returns a list of length 1");
auto levelString = trimWhitespace(handlerPieces[0]);
bool hasHandlerConfig = handlerPieces.size() > 1;
std::pair<std::string, LogHandlerConfig> parseHandlerConfig(StringPiece value) {
std::vector<StringPiece> pieces;
folly::split(",", value, pieces);
- // "folly::split() always returns a list of length 1";
- assert(pieces.size() >= 1);
+ FOLLY_SAFE_DCHECK(
+ pieces.size() >= 1, "folly::split() always returns a list of length 1");
StringPiece handlerName;
StringPiece handlerType;
// From then on each section specifies a single LogHandler config.
std::vector<StringPiece> pieces;
folly::split(";", value, pieces);
- // "folly::split() always returns a list of length 1";
- assert(pieces.size() >= 1);
+ FOLLY_SAFE_DCHECK(
+ pieces.size() >= 1, "folly::split() always returns a list of length 1");
auto categoryConfigs = parseCategoryConfigs(pieces[0]);
LogConfig::HandlerConfigMap handlerConfigs;
#include <folly/futures/Future.h>
#include <folly/futures/Promise.h>
#include <folly/init/Init.h>
+#include <folly/lang/SafeAssert.h>
#include <folly/portability/GFlags.h>
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
}
void writerFinished(size_t threadID, size_t messagesWritten, uint32_t flags) {
auto map = perThreadWriteData_.wlock();
- assert(map->find(threadID) == map->end());
+ FOLLY_SAFE_CHECK(
+ map->find(threadID) == map->end(),
+ "multiple writer threads with same ID");
auto& data = (*map)[threadID];
data.numMessagesWritten = messagesWritten;
data.flags = flags;