mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
9a5f0093f2
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
37 lines
809 B
C++
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
|