summaryrefslogtreecommitdiffstats
path: root/logd/src/logd/forwarder.h
blob: 93cfdb3de9f843d160f31b9b8a3548da1aec78ff (plain) (blame)
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
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/log/log.h>
#include <map>
#include <string_view>

namespace logdemon {

// Mapping saying if a level should be forwarded or not
using ForwardMap = std::map<ns_log::Logger::LogLevel, bool>;

/**
 * Interface used to forward log lines to something.
 */
class Forwarder {
public:
    virtual ~Forwarder() {}
    virtual void sendMode() = 0;
    virtual void forwardLine(std::string_view log_line) = 0;
    virtual void flush() = 0;
    virtual int badLines() const = 0;
    virtual void resetBadLines() = 0;
};

}