sapling/eden/fs/telemetry/ScribeLogger.h
Chad Austin 9a5f0093f2 introduce a scribe logger that communicates with scribe_cat
Summary: Introduce a new ScribeLogger class that spawns and maintains a process. Log messages are newline-delimited and written to the process's stdin. If the process stops responding or responds too slowly, log messages are dropped.

Reviewed By: pkaush

Differential Revision: D17777215

fbshipit-source-id: c998d10c73fc103122d69ae19c5d84f58b7939d2
2019-10-22 12:42:54 -07:00

37 lines
809 B
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/Range.h>
#include <string>
namespace facebook {
namespace eden {
/**
* An interface to a scribe logger implementation.
*
* Subclasses must override either of the log overloads.
*
* Messages must not contain newlines. Messages are not durable. They may be
* dropped under load or for other reasons.
*/
class ScribeLogger {
public:
virtual ~ScribeLogger() = default;
virtual void log(folly::StringPiece message) {
return log(message.str());
}
virtual void log(std::string message) {
return log(folly::StringPiece{message});
}
};
} // namespace eden
} // namespace facebook