sapling/eden/fs/store/BackingStoreLogger.h
Katie Mancini 3827b9787d add fetch type to data fetch logging
Summary:
Having the type of data fetched can help in debugging where these fetches are
comming from. In the currently logs figuring out if a data fetch is blob or
tree requires some manual work. When looking at a big bunch of fetches this is
not super practical.

So this includes this info in our logging.

Reviewed By: chadaustin

Differential Revision: D23243444

fbshipit-source-id: 9abe5180c5d2afc0d02b27ba6a6b76401e86556e
2020-08-21 17:38:14 -07:00

47 lines
1.1 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
#include <folly/Executor.h>
#include <string>
#include "eden/fs/store/ObjectFetchContext.h"
#include "eden/fs/utils/PathFuncs.h"
namespace facebook {
namespace eden {
class UnboundedQueueExecutor;
class StructuredLogger;
class ProcessNameCache;
class BackingStoreLogger {
public:
BackingStoreLogger(
std::shared_ptr<StructuredLogger> logger,
std::shared_ptr<ProcessNameCache> processNameCache);
// for unit tests so that a no-op logger can be passed into the backing store
BackingStoreLogger() = default;
void logImport(
ObjectFetchContext& context,
RelativePathPiece importPath,
ObjectFetchContext::ObjectType fetchedType);
private:
std::shared_ptr<StructuredLogger> logger_;
std::shared_ptr<ProcessNameCache> processNameCache_;
// for unit tests so that a no-op logger can be passed into the backing store
bool loggingAvailable_ = false;
};
} // namespace eden
} // namespace facebook