1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <chrono>
#include <memory>
#include <string>
#include "opentelemetry/sdk/logs/processor.h"
#include "opentelemetry/sdk/logs/recordable.h"
class CustomLogRecordProcessor : public opentelemetry::sdk::logs::LogRecordProcessor
{
public:
CustomLogRecordProcessor(const std::string &comment) : comment_(comment) {}
CustomLogRecordProcessor(CustomLogRecordProcessor &&) = delete;
CustomLogRecordProcessor(const CustomLogRecordProcessor &) = delete;
CustomLogRecordProcessor &operator=(CustomLogRecordProcessor &&) = delete;
CustomLogRecordProcessor &operator=(const CustomLogRecordProcessor &other) = delete;
~CustomLogRecordProcessor() override = default;
std::unique_ptr<opentelemetry::sdk::logs::Recordable> MakeRecordable() noexcept override;
void OnEmit(std::unique_ptr<opentelemetry::sdk::logs::Recordable> &&record) noexcept override;
bool ForceFlush(std::chrono::microseconds timeout) noexcept override;
bool Shutdown(std::chrono::microseconds timeout) noexcept override;
private:
std::string comment_;
};
|